Class: Brita::Parameter
- Inherits:
-
Object
- Object
- Brita::Parameter
- Defined in:
- lib/brita/parameter.rb
Overview
Value Object that wraps some handling of filter params
Instance Attribute Summary collapse
-
#internal_name ⇒ Object
readonly
Returns the value of attribute internal_name.
-
#param ⇒ Object
readonly
Returns the value of attribute param.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #handler ⇒ Object
-
#initialize(param, type, internal_name = param) ⇒ Parameter
constructor
A new instance of Parameter.
- #parse_options ⇒ Object
Constructor Details
#initialize(param, type, internal_name = param) ⇒ Parameter
Returns a new instance of Parameter.
6 7 8 9 10 |
# File 'lib/brita/parameter.rb', line 6 def initialize(param, type, internal_name = param) @param = param @type = type @internal_name = internal_name end |
Instance Attribute Details
#internal_name ⇒ Object (readonly)
Returns the value of attribute internal_name.
4 5 6 |
# File 'lib/brita/parameter.rb', line 4 def internal_name @internal_name end |
#param ⇒ Object (readonly)
Returns the value of attribute param.
4 5 6 |
# File 'lib/brita/parameter.rb', line 4 def param @param end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/brita/parameter.rb', line 4 def type @type end |
Instance Method Details
#handler ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/brita/parameter.rb', line 20 def handler if type == :scope ScopeHandler.new(self) else WhereHandler.new(self) end end |
#parse_options ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/brita/parameter.rb', line 12 def { supports_boolean: supports_boolean?, supports_ranges: supports_ranges?, supports_json: supports_json? } end |