Class: QueryStringSearch::KeyValue
- Inherits:
-
Object
- Object
- QueryStringSearch::KeyValue
- Defined in:
- lib/query_string_search/search_option.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#desired_value ⇒ Object
Returns the value of attribute desired_value.
-
#operator ⇒ Object
Returns the value of attribute operator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(match_data) ⇒ KeyValue
constructor
A new instance of KeyValue.
Constructor Details
#initialize(match_data) ⇒ KeyValue
Returns a new instance of KeyValue.
28 29 30 31 32 33 |
# File 'lib/query_string_search/search_option.rb', line 28 def initialize(match_data) match_data = match_data ? match_data : {} self.attribute = match_data[:attribute] self.desired_value = match_data[:desired_value] self.operator = match_data[:operator] end |
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute.
22 23 24 |
# File 'lib/query_string_search/search_option.rb', line 22 def attribute @attribute end |
#desired_value ⇒ Object
Returns the value of attribute desired_value.
22 23 24 |
# File 'lib/query_string_search/search_option.rb', line 22 def desired_value @desired_value end |
#operator ⇒ Object
Returns the value of attribute operator.
22 23 24 |
# File 'lib/query_string_search/search_option.rb', line 22 def operator @operator end |
Class Method Details
.parse(raw_query) ⇒ Object
24 25 26 |
# File 'lib/query_string_search/search_option.rb', line 24 def self.parse(raw_query) new(/(?<attribute>\w+)(?<operator>\W+)(?<desired_value>.+)/.match(raw_query)) end |