Sha256: 649368547901611bce08c51efc7c566ad75313b440057146061e6a937eca99e2

Contents?: true

Size: 328 Bytes

Versions: 2

Compression:

Stored size: 328 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 { [*_1.split(":").map(&:strip)] }
      pairs.to_h.symbolize_keys
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lookbook-1.2.1 lib/lookbook/services/search_param_parser.rb
lookbook-1.2.0 lib/lookbook/services/search_param_parser.rb