Class: Resourcey::FilterProcessor
- Inherits:
-
Object
- Object
- Resourcey::FilterProcessor
- Defined in:
- lib/resourcey/filter_processor.rb
Constant Summary collapse
- ALLOWED_OPTIONS =
%i[multivalue].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #apply(permitted_param, scope) ⇒ Object
-
#initialize(name, opts = {}, &block) ⇒ FilterProcessor
constructor
A new instance of FilterProcessor.
Constructor Details
#initialize(name, opts = {}, &block) ⇒ FilterProcessor
Returns a new instance of FilterProcessor.
7 8 9 10 11 12 13 |
# File 'lib/resourcey/filter_processor.rb', line 7 def initialize(name, opts = {}, &block) @name = name.to_s @opts = opts @block = block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/resourcey/filter_processor.rb', line 5 def name @name end |
Instance Method Details
#apply(permitted_param, scope) ⇒ Object
15 16 17 18 |
# File 'lib/resourcey/filter_processor.rb', line 15 def apply(permitted_param, scope) filter_value = parse_filter_value(permitted_param) block.call(filter_value, scope) end |