class T::Types::TypedHash
Attributes
keys[R]
Technically we don't need these, but they are a nice api
values[R]
Technically we don't need these, but they are a nice api
Public Class Methods
new(keys:, values:)
click to toggle source
# File lib/types/types/typed_hash.rb, line 13 def initialize(keys:, values:) @keys = T::Utils.coerce(keys) @values = T::Utils.coerce(values) @type = T::Utils.coerce([keys, values]) end
Public Instance Methods
name()
click to toggle source
@override Base
# File lib/types/types/typed_hash.rb, line 20 def name "T::Hash[#{@keys.name}, #{@values.name}]" end
new(*args, &blk)
click to toggle source
# File lib/types/types/typed_hash.rb, line 34 def new(*args, &blk) Hash.new(*T.unsafe(args), &blk) end
recursively_valid?(obj)
click to toggle source
@override Base
Calls superclass method
T::Types::TypedEnumerable#recursively_valid?
# File lib/types/types/typed_hash.rb, line 25 def recursively_valid?(obj) obj.is_a?(Hash) && super end
underlying_class()
click to toggle source
# File lib/types/types/typed_hash.rb, line 9 def underlying_class Hash end
valid?(obj)
click to toggle source
@override Base
# File lib/types/types/typed_hash.rb, line 30 def valid?(obj) obj.is_a?(Hash) end