Class: Fairy::FilterChain
- Inherits:
-
Object
- Object
- Fairy::FilterChain
show all
- Defined in:
- lib/fairy.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FilterChain.
180
181
182
|
# File 'lib/fairy.rb', line 180
def initialize(input)
@filters = [input]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg, *args, &block) ⇒ Object
194
195
196
197
198
199
200
201
202
203
|
# File 'lib/fairy.rb', line 194
def method_missing(msg, *args, &block)
ret = @filters.last.__send__(msg, *args, &block)
if ret.kind_of?(Job)
@filters << ret
self
else
ret
end
end
|
Instance Method Details
#[](idx) ⇒ Object
184
185
186
|
# File 'lib/fairy.rb', line 184
def [](idx)
@filters[idx]
end
|
#show_chain ⇒ Object
188
189
190
191
192
|
# File 'lib/fairy.rb', line 188
def show_chain
@filters.each_with_index{|f, idx|
puts "[#{idx}]\t#{f.class}"
}
end
|