Class: KRPC::Types::EnumType
Instance Attribute Summary collapse
-
#enum_name ⇒ Object
readonly
Returns the value of attribute enum_name.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
Attributes inherited from TypeBase
Instance Method Summary collapse
-
#initialize(type_string) ⇒ EnumType
constructor
A new instance of EnumType.
- #set_values(values) ⇒ Object
Constructor Details
#initialize(type_string) ⇒ EnumType
Returns a new instance of EnumType.
171 172 173 174 175 176 177 |
# File 'lib/krpc/types.rb', line 171 def initialize(type_string) m = /Enum\(([^\.]+)\.([^\.]+)\)/.match type_string raise(ValueError, "\"#{type_string}\" is not a valid type string for a enumeration type") unless m @service_name, @enum_name = m[1..2] # Sets ruby_type to nil, set_values must be called to set the ruby_type super(type_string, nil) end |
Instance Attribute Details
#enum_name ⇒ Object (readonly)
Returns the value of attribute enum_name.
170 171 172 |
# File 'lib/krpc/types.rb', line 170 def enum_name @enum_name end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
170 171 172 |
# File 'lib/krpc/types.rb', line 170 def service_name @service_name end |
Instance Method Details
#set_values(values) ⇒ Object
179 180 181 |
# File 'lib/krpc/types.rb', line 179 def set_values(values) @ruby_type = Gen.generate_enum(service_name, enum_name, values) end |