Class: EnumStatement
Overview
Represents an Enum statement
Instance Method Summary collapse
-
#flags? ⇒ Bool
Returns true if this enum uses bitmask flags.
-
#name ⇒ String
The name of the enum.
-
#to_hash ⇒ Object
Hash representation of this Enum.
-
#type ⇒ String
The type of the enum.
-
#variables ⇒ Object
Returns a list of EnumVariable objects.
Instance Method Details
#flags? ⇒ Bool
Returns true if this enum uses bitmask flags
24 25 26 |
# File 'lib/steamd/nodes/enum_statement_node.rb', line 24 def flags? type == 'flags' end |
#name ⇒ String
The name of the enum
10 11 12 |
# File 'lib/steamd/nodes/enum_statement_node.rb', line 10 def name enum_name.text_value end |
#to_hash ⇒ Object
Hash representation of this Enum
42 43 44 45 46 47 48 49 |
# File 'lib/steamd/nodes/enum_statement_node.rb', line 42 def to_hash { name: name, type: type, flags: flags?, variables: variables } end |
#type ⇒ String
The type of the enum
17 18 19 |
# File 'lib/steamd/nodes/enum_statement_node.rb', line 17 def type enum_type.type.text_value if enum_type.respond_to?(:type) end |
#variables ⇒ Object
Returns a list of EnumVariable objects
31 32 33 34 35 36 37 38 39 |
# File 'lib/steamd/nodes/enum_statement_node.rb', line 31 def variables declerations = [first_var] + other.elements.map(&:enum_decleration) variables = declerations.select do |node| node.is_a?(EnumVariable) end variables.map!(&:to_hash) end |