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.38 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.37 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.36 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.35 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.34 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.33 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.32 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.31 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.30 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.29 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.28 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.27 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.26 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.25 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.24 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.23 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.22 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.21 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.20 projects/builtin_types/src/attributes/casters/array.rb
foobara-0.0.19 projects/builtin_types/src/attributes/casters/array.rb