Class: KRPC::Types::DictionaryType
- Defined in:
- lib/krpc/types.rb
Instance Attribute Summary collapse
-
#key_type ⇒ Object
readonly
Returns the value of attribute key_type.
-
#value_type ⇒ Object
readonly
Returns the value of attribute value_type.
Attributes inherited from TypeBase
Instance Method Summary collapse
-
#initialize(type_string) ⇒ DictionaryType
constructor
A new instance of DictionaryType.
Constructor Details
#initialize(type_string) ⇒ DictionaryType
Returns a new instance of DictionaryType.
196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/krpc/types.rb', line 196 def initialize(type_string) m = /^Dictionary\((.+)\)$/.match type_string raise(ValueError, "\"#{type_string}\" is not a valid type string for a dictionary type") unless m key_string, type = parse_type_string(m[1]) value_string, type = parse_type_string(type) raise(ValueError, "\"#{type_string}\" is not a valid type string for a dictionary type") unless type.nil? @key_type = TypeStore[key_string] @value_type = TypeStore[value_string] super(type_string, Hash) end |
Instance Attribute Details
#key_type ⇒ Object (readonly)
Returns the value of attribute key_type.
195 196 197 |
# File 'lib/krpc/types.rb', line 195 def key_type @key_type end |
#value_type ⇒ Object (readonly)
Returns the value of attribute value_type.
195 196 197 |
# File 'lib/krpc/types.rb', line 195 def value_type @value_type end |