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



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

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

#inspectObject



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

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

#keysObject



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

def keys
  @storage[:keys]
end

#keys=(keys) ⇒ Object



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

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

#normalizeObject



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

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

#typeObject



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

def type
  ::Hash
end