Class: KRPC::Types::TupleType

Inherits:
TypeBase
  • Object
show all
Defined in:
lib/krpc/types.rb

Instance Attribute Summary collapse

Attributes inherited from TypeBase

#protobuf_type, #ruby_type

Instance Method Summary collapse

Constructor Details

#initialize(type_string) ⇒ TupleType

Returns a new instance of TupleType.

Raises:



222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/krpc/types.rb', line 222

def initialize(type_string)
  m = /^Tuple\((.+)\)$/.match type_string
  raise(ValueError, "\"#{type_string}\" is not a valid type string for a tuple type") unless m

  @value_types = []
  type = m[1]
  until type.nil?
    value_type, type = parse_type_string(type)
    @value_types << TypeStore[value_type]
  end

  super(type_string, Array)
end

Instance Attribute Details

#value_typesObject (readonly)

Returns the value of attribute value_types.



221
222
223
# File 'lib/krpc/types.rb', line 221

def value_types
  @value_types
end