Class: Typical::Type::Hash

Inherits:
List show all
Defined in:
lib/typical/type/list.rb

Instance Attribute Summary

Attributes inherited from List

#storage

Instance Method Summary collapse

Methods inherited from List

#empty?, #eql?, #hash, #initialize, #values, #values=

Methods inherited from Typical::Type

#eql?, #hash, #initialize, #nullable?, of, #prominent_type, #types, #|

Constructor Details

This class inherits a constructor from Typical::Type::List

Instance Method Details

#==(other) ⇒ Object



105
106
107
# File 'lib/typical/type/list.rb', line 105

def ==(other)
  super && keys == other.keys
end

#inspectObject



101
102
103
# File 'lib/typical/type/list.rb', line 101

def inspect
  "#<Type:#{type} { [#{keys.inspect}] => [#{values.inspect}] }>"
end

#keysObject



93
94
95
# File 'lib/typical/type/list.rb', line 93

def keys
  @storage[:keys]
end

#keys=(keys) ⇒ Object



97
98
99
# File 'lib/typical/type/list.rb', line 97

def keys=(keys)
  @storage[:keys] = keys
end

#normalizeObject



89
90
91
# File 'lib/typical/type/list.rb', line 89

def normalize
  super.tap { |copy| copy.keys = keys.normalize(false) }
end

#typeObject



85
86
87
# File 'lib/typical/type/list.rb', line 85

def type
  ::Hash
end