Class: Literal::Hash::Generic

Inherits:
Object
  • Object
show all
Defined in:
lib/literal/hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(key_type, value_type) ⇒ Generic



5
6
7
8
# File 'lib/literal/hash.rb', line 5

def initialize(key_type, value_type)
  @key_type = key_type
  @value_type = value_type
end

Instance Method Details

#===(value) ⇒ Object



14
15
16
# File 'lib/literal/hash.rb', line 14

def ===(value)
  Literal::Hash === value && @type == value.__type__
end

#inspectObject



18
19
20
# File 'lib/literal/hash.rb', line 18

def inspect
  "Literal::Hash(#{@type.inspect})"
end

#new(**value) ⇒ Object



10
11
12
# File 'lib/literal/hash.rb', line 10

def new(**value)
  Literal::Hash.new(value, key_type: @key_type, value_type: @value_type)
end