Sha256: d743fbd9c4341a4b94a15c83e77f7633c1e9205a4260e8c958c8093243b548bd
Contents?: true
Size: 804 Bytes
Versions: 62
Compression:
Stored size: 804 Bytes
Contents
module Workarea module Search class HashText attr_reader :hash def initialize(hash) @hash = hash || {} end # Flatten out all values in the hash and # returns a comma-delimited string. Used for # entering catalog Hash data into the search index # for full text searching. # # @return [String] # def text hash.map do |key, value| value_string = if value.is_a?(Hash) HashText.new(value).text elsif value.is_a?(Array) value.join(', ') else value end "#{key.to_s.humanize}: #{value_string}" end.join('; ') end end end end
Version data entries
62 entries across 62 versions & 1 rubygems