Sha256: b140d90dd63b233eb3760b8958eeb16530e113b90bb191518ede7671aaf462be

Contents?: true

Size: 455 Bytes

Versions: 27

Compression:

Stored size: 455 Bytes

Contents

module Foobara
  module BuiltinTypes
    module Array
      module Casters
        class Arrayable < Value::Caster
          def applicable?(value)
            !value.is_a?(::Array) && value.respond_to?(:to_a)
          end

          def applies_message
            "respond to :to_a"
          end

          def cast(object)
            # TODO: This is probably too lenient
            object.to_a
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.6 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.5 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.4 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.3 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.2 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.1 projects/builtin_types/src/array/casters/arrayable.rb