Sha256: 8d422cdbb9f8fdabc2a640b1f097f2957f9fc3b2ca75f761a511afb18019b31a

Contents?: true

Size: 506 Bytes

Versions: 15

Compression:

Stored size: 506 Bytes

Contents

module Kafo
  module Params
    class Hash < Param
      def value=(value)
        super
        @value = typecast(@value)
      end

      def multivalued?
        true
      end

      def condition_value
        value.inspect
      end

      private

      def typecast(value)
        if value.nil?
          nil
        elsif value.is_a?(::Hash)
          value
        else
          value = [value].flatten
          ::Hash[value.map { |v| v.split(':', 2) }]
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kafo-0.3.17 lib/kafo/params/hash.rb
kafo-0.4.0 lib/kafo/params/hash.rb
kafo-0.3.16 lib/kafo/params/hash.rb
kafo-0.3.15 lib/kafo/params/hash.rb
kafo-0.3.14 lib/kafo/params/hash.rb
kafo-0.3.13 lib/kafo/params/hash.rb
kafo-0.3.12 lib/kafo/params/hash.rb
kafo-0.3.11 lib/kafo/params/hash.rb
kafo-0.3.10 lib/kafo/params/hash.rb
kafo-0.3.9 lib/kafo/params/hash.rb
kafo-0.3.8 lib/kafo/params/hash.rb
kafo-0.3.7 lib/kafo/params/hash.rb
kafo-0.3.6 lib/kafo/params/hash.rb
kafo-0.3.5 lib/kafo/params/hash.rb
kafo-0.3.4 lib/kafo/params/hash.rb