Class: Filter
Direct Known Subclasses
Instance Attribute Summary collapse
-
#full_name ⇒ Object
Returns the value of attribute full_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#next ⇒ Object
Returns the value of attribute next.
-
#regexp ⇒ Object
Returns the value of attribute regexp.
Class Method Summary collapse
Instance Method Summary collapse
- #add(nxt) ⇒ Object
- #each {|_self| ... } ⇒ Object
- #filter(path, file) ⇒ Object
-
#initialize(regexp, nxt = nil, full_name = false) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(regexp, nxt = nil, full_name = false) ⇒ Filter
Returns a new instance of Filter.
13 14 15 16 17 |
# File 'lib/filters.rb', line 13 def initialize(regexp, nxt = nil, full_name = false) @next = nxt @regexp = regexp @full_name = full_name end |
Instance Attribute Details
#full_name ⇒ Object
Returns the value of attribute full_name.
11 12 13 |
# File 'lib/filters.rb', line 11 def full_name @full_name end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/filters.rb', line 11 def name @name end |
#next ⇒ Object
Returns the value of attribute next.
11 12 13 |
# File 'lib/filters.rb', line 11 def next @next end |
#regexp ⇒ Object
Returns the value of attribute regexp.
11 12 13 |
# File 'lib/filters.rb', line 11 def regexp @regexp end |
Class Method Details
.add(orig, nxt) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/filters.rb', line 3 def self.add(orig, nxt) if orig orig.add nxt else nxt end end |
Instance Method Details
#add(nxt) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/filters.rb', line 19 def add(nxt) if @next @next.add nxt else @next = nxt end self end |
#each {|_self| ... } ⇒ Object
36 37 38 39 |
# File 'lib/filters.rb', line 36 def each(&b) yield self @next.each(&b) if @next end |
#filter(path, file) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/filters.rb', line 28 def filter(path, file) unless @regexp =~ text(path, file) next_filter(path, file) else false end end |