Class: Typhoeus::Filter
- Inherits:
-
Object
- Object
- Typhoeus::Filter
- Defined in:
- lib/typhoeus/filter.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
Instance Method Summary collapse
- #apply_filter?(method_name) ⇒ Boolean
-
#initialize(method_name, options = {}) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(method_name, options = {}) ⇒ Filter
Returns a new instance of Filter.
5 6 7 8 |
# File 'lib/typhoeus/filter.rb', line 5 def initialize(method_name, = {}) @method_name = method_name @options = end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
3 4 5 |
# File 'lib/typhoeus/filter.rb', line 3 def method_name @method_name end |
Instance Method Details
#apply_filter?(method_name) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/typhoeus/filter.rb', line 10 def apply_filter?(method_name) if @options[:only] if @options[:only].instance_of? Symbol @options[:only] == method_name else @options[:only].include?(method_name) end elsif @options[:except] if @options[:except].instance_of? Symbol @options[:except] != method_name else !@options[:except].include?(method_name) end else true end end |