Class: Literal::Hash::Generic
- Inherits:
-
Object
- Object
- Literal::Hash::Generic
- Defined in:
- lib/literal/hash.rb
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(key_type, value_type) ⇒ Generic
constructor
A new instance of Generic.
- #inspect ⇒ Object
- #new(**value) ⇒ Object
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 |
#inspect ⇒ Object
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 |