Sha256: b140d90dd63b233eb3760b8958eeb16530e113b90bb191518ede7671aaf462be

Contents?: true

Size: 455 Bytes

Versions: 26

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

26 entries across 26 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.25 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.24 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.23 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.22 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.21 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.20 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.19 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.18 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.17 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.16 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.15 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.14 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.13 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.12 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.11 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.10 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.9 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.8 projects/builtin_types/src/array/casters/arrayable.rb
foobara-0.0.7 projects/builtin_types/src/array/casters/arrayable.rb