Class: Axiom::Types::Hash

Inherits:
Object show all
Defined in:
lib/axiom/types/hash.rb

Overview

Represents a hash type

Class Method Summary collapse

Methods inherited from Type

constraint, include?, includes, new

Methods included from Options

#accept_options

Class Method Details

.finalizeClass<Axiom::Types::Hash>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Finalize by setting up constraints for the key and value



39
40
41
42
43
44
45
# File 'lib/axiom/types/hash.rb', line 39

def self.finalize
  return self if frozen?
  key_type.finalize
  value_type.finalize
  matches_key_and_value_types
  super
end

.infer(object) ⇒ Class<Axiom::Types::Hash>?

Infer the type of the object

Parameters:

Returns:



25
26
27
28
29
30
31
32
# File 'lib/axiom/types/hash.rb', line 25

def self.infer(object)
  case object
  when primitive
    infer_from_primitive_instance(object)
  else
    super
  end
end