Sha256: 9639c9d784a0d5b32f4fbe5eac2ed0dde0d7a0667bb817c7d1edd7fc86246fbe

Contents?: true

Size: 337 Bytes

Versions: 16

Compression:

Stored size: 337 Bytes

Contents

module Lookbook
  class SearchParamParser < Service
    attr_reader :param_value

    def initialize(param_value)
      @param_value = param_value.strip
    end

    def call
      pairs_str = param_value.split("|")
      pairs = pairs_str.map { |pair| [*pair.split(":").map(&:strip)] }
      pairs.to_h.symbolize_keys
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lookbook-1.5.5 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.5.4 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.5.3 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.5.2 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.5.1 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.5.0 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.4.5 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.4.4 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.4.3 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.4.2 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.4.1 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.4.0 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.3.4 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.3.3 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.3.1 lib/lookbook/services/urls/search_param_parser.rb
lookbook-1.3.0 lib/lookbook/services/urls/search_param_parser.rb