Class: JsonApiFilter::FilterBy
- Inherits:
-
Object
- Object
- JsonApiFilter::FilterBy
- Defined in:
- lib/json_api_filter/filter_by.rb
Instance Attribute Summary collapse
-
#attr ⇒ Object
readonly
Returns the value of attribute attr.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(attr, value) ⇒ FilterBy
constructor
A new instance of FilterBy.
- #to_hash ⇒ Object
Constructor Details
#initialize(attr, value) ⇒ FilterBy
Returns a new instance of FilterBy.
6 7 8 9 |
# File 'lib/json_api_filter/filter_by.rb', line 6 def initialize(attr, value) @attr = attr @value = value end |
Instance Attribute Details
#attr ⇒ Object (readonly)
Returns the value of attribute attr.
4 5 6 |
# File 'lib/json_api_filter/filter_by.rb', line 4 def attr @attr end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/json_api_filter/filter_by.rb', line 4 def value @value end |
Instance Method Details
#to_hash ⇒ Object
11 12 13 14 15 |
# File 'lib/json_api_filter/filter_by.rb', line 11 def to_hash return {} unless parsed_value.present? { key.to_sym => parsed_value } end |