| Class | Uttk::Filters::RPathFilter |
| In: |
lib/uttk/filters/RPathFilter.rb
|
| Parent: | Id |
| log | [R] | FIXME include Abstract |
The _aRegexpPath_ is matched against the path of every notification
the filter receive. If the notification path matches, then the method mentioned as second argument is called. If no method are mentioned, it looks for a block. You must supply either a method or a block, not both.
# File lib/uttk/filters/RPathFilter.rb, line 68 def self.match ( aRegexPath, aMethod=nil, &block ) if aMethod.nil? and block.nil? raise ArgumentError, "no block or method given" end if aMethod and block raise ArgumentError, "supply a block OR a method name not both" end self.matchers = matchers + [Matcher.new(aRegexPath, aMethod, &block)] end
# File lib/uttk/filters/RPathFilter.rb, line 16 def initialize ( *a, &b ) @log = Logger.new # FIXME PERAPHS you can remove me @matchers = matchers.dup super end
# File lib/uttk/filters/RPathFilter.rb, line 23 def add_observer ( obj ) @log.add_observer(obj) super end
# File lib/uttk/filters/RPathFilter.rb, line 29 def new_leaf ( lpath, leaf ) lpath << leaf @matchers.each do |matcher| next unless matcher.active? if matcher.have_a_star? buf = matcher.buffer is_prefix = lpath.rpath_prefix(matcher.re) unless buf.empty? or is_prefix buf.buffer.rpath(matcher.re) do |*args| matcher[self, *args] end buf.reset end if is_prefix if buf.empty? l = Logger.new(buf) lpath.each do |seg| l.new_node seg.segment, seg.options end end buf.update(:new_leaf, lpath, leaf) end else lpath.rpath(matcher.re) do |*args| matcher[self, *args] end end end end