Sha256: fbc5642f92340a44ef1dcadad4c017dae8eae4f6a87c9c88e04c25694e1f53a7

Contents?: true

Size: 364 Bytes

Versions: 6

Compression:

Stored size: 364 Bytes

Contents

# frozen_string_literal: true

using SmartCore::Ext::BasicObjectAsObject

# @api public
# @since 0.1.0
# @version 0.3.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

6 entries across 6 versions & 1 rubygems

Version Path
smart_types-0.8.0 lib/smart_core/types/value/array.rb
smart_types-0.7.1 lib/smart_core/types/value/array.rb
smart_types-0.7.0 lib/smart_core/types/value/array.rb
smart_types-0.6.0 lib/smart_core/types/value/array.rb
smart_types-0.4.0 lib/smart_core/types/value/array.rb
smart_types-0.3.0 lib/smart_core/types/value/array.rb