Sha256: 955d865f173c9634798c7f65be60bd7bc5988848792a9000f720c55e091ce50b

Contents?: true

Size: 664 Bytes

Versions: 38

Compression:

Stored size: 664 Bytes

Contents

module Foobara
  module BuiltinTypes
    module Attributes
      module Casters
        class Array < AssociativeArray::Casters::Array
          def applicable?(value)
            if super
              hash_caster.applicable?(to_h(value))
            end
          end

          def applies_message
            "be a an array of pairs"
          end

          def cast(array)
            hash_caster.cast(super)
          end

          private

          def hash_caster
            @hash_caster ||= Hash.instance
          end

          def to_h(value)
            method(:cast).super_method.call(value)
          end
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
foobara-0.0.18 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.17 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.16 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.15 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.14 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.13 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.12 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.11 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.10 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.9 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.8 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.7 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.6 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.5 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.4 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.3 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.2 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.1 projects/builtin_types/src/attributes/casters/array.rb