Class: QueryStringSearch::SearchOptions
- Inherits:
-
Object
- Object
- QueryStringSearch::SearchOptions
- Defined in:
- lib/query_string_search/search_options.rb
Instance Attribute Summary collapse
-
#search_param ⇒ Object
readonly
Returns the value of attribute search_param.
-
#search_type ⇒ Object
readonly
Returns the value of attribute search_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw_query) ⇒ SearchOptions
constructor
A new instance of SearchOptions.
Constructor Details
#initialize(raw_query) ⇒ SearchOptions
Returns a new instance of SearchOptions.
16 17 18 |
# File 'lib/query_string_search/search_options.rb', line 16 def initialize(raw_query) self.search_type, self.search_param = raw_query.to_s.split("=") end |
Instance Attribute Details
#search_param ⇒ Object
Returns the value of attribute search_param.
3 4 5 |
# File 'lib/query_string_search/search_options.rb', line 3 def search_param @search_param end |
#search_type ⇒ Object
Returns the value of attribute search_type.
3 4 5 |
# File 'lib/query_string_search/search_options.rb', line 3 def search_type @search_type end |
Class Method Details
.parse(query_string) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/query_string_search/search_options.rb', line 5 def self.parse(query_string) if query_string search_params = query_string.split(",") search_params.each_with_object([]) do |p, ret| ret << new(p) end else [new(nil)] end end |