Sha256: f29b37be1f57b3c3320d051f63767401b0679c4f8d7abb840c6c81b01714653b

Contents?: true

Size: 296 Bytes

Versions: 7

Compression:

Stored size: 296 Bytes

Contents

# frozen_string_literal: true

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

  type.define_caster do |value|
    begin
      ::Kernel.Hash(value)
    rescue ::TypeError
      {}
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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