Sha256: 63d32e100f6568679f37a5a76850f1cdf3ba237dd9b2e147763b25e6475299fb

Contents?: true

Size: 304 Bytes

Versions: 9

Compression:

Stored size: 304 Bytes

Contents

# frozen_string_literal: true

# @api public
# @since 0.1.0
SmartCore::Types::Value.define_type(:Array) do |type|
  type.define_checker do |value|
    value.is_a?(::Array)
  end

  type.define_caster do |value|
    begin
      ::Kernel.Array(value)
    rescue ::TypeError
      [value]
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
smart_types-0.2.0 lib/smart_core/types/value/array.rb
smart_types-0.1.0 lib/smart_core/types/value/array.rb
smart_types-0.1.0.alpha6 lib/smart_core/types/value/array.rb
smart_types-0.1.0.alpha5 lib/smart_core/types/value/array.rb
smart_types-0.1.0.alpha4 lib/smart_core/types/value/array.rb
smart_types-0.1.0.alpha3 lib/smart_core/types/value/array.rb
smart_types-0.1.0.alpha2 lib/smart_core/types/value/array.rb
smart_types-0.1.0.alpha lib/smart_core/types/value/array.rb
smart_types-0.0.0 lib/smart_core/types/value/array.rb