Class: Lookbook::SearchParamParser
- Defined in:
- lib/lookbook/services/urls/search_param_parser.rb
Instance Attribute Summary collapse
-
#param_value ⇒ Object
readonly
Returns the value of attribute param_value.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(param_value) ⇒ SearchParamParser
constructor
A new instance of SearchParamParser.
Methods inherited from Service
Constructor Details
#initialize(param_value) ⇒ SearchParamParser
Returns a new instance of SearchParamParser.
5 6 7 |
# File 'lib/lookbook/services/urls/search_param_parser.rb', line 5 def initialize(param_value) @param_value = param_value.strip end |
Instance Attribute Details
#param_value ⇒ Object (readonly)
Returns the value of attribute param_value.
3 4 5 |
# File 'lib/lookbook/services/urls/search_param_parser.rb', line 3 def param_value @param_value end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 |
# File 'lib/lookbook/services/urls/search_param_parser.rb', line 9 def call pairs_str = param_value.split("|") pairs = pairs_str.map { |pair| [*pair.split(":").map(&:strip)] } pairs.to_h.symbolize_keys end |