Class: Hash::HashType
- Inherits:
-
Object
- Object
- Hash::HashType
- Defined in:
- lib/hash.rb
Instance Method Summary collapse
-
#initialize(key_type, value_type) ⇒ HashType
constructor
A new instance of HashType.
- #is_type_of?(k, v) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(key_type, value_type) ⇒ HashType
Returns a new instance of HashType.
3 4 5 6 |
# File 'lib/hash.rb', line 3 def initialize key_type, value_type @key_type = key_type @value_type = value_type end |
Instance Method Details
#is_type_of?(k, v) ⇒ Boolean
8 9 10 |
# File 'lib/hash.rb', line 8 def is_type_of? k, v k.kind_of?(@key_type) and v.kind_of?(@value_type) end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/hash.rb', line 12 def to_s "Hash[#{@key_type}, #{@value_type}]" end |