Class: Variable
Overview
Base variable, each variable has a type and a name at the very least.
Direct Known Subclasses
Instance Method Summary collapse
-
#name ⇒ String
Returns the name of the variable.
-
#size ⇒ String/Integer/nil
Returns the size, if any of the variable.
-
#to_hash ⇒ Hash
Hash representation of this Variable Node.
-
#type ⇒ String
Returns the type of the variable.
Instance Method Details
#name ⇒ String
Returns the name of the variable
7 8 9 |
# File 'lib/steamd/nodes/variable_node.rb', line 7 def name variable_name.text_value end |
#size ⇒ String/Integer/nil
Returns the size, if any of the variable. ie byte<6> y;
21 22 23 24 25 26 27 28 29 |
# File 'lib/steamd/nodes/variable_node.rb', line 21 def size return nil unless var_type && var_type.respond_to?(:size) if var_type.size.text_value.empty? nil else var_type.size.var_value.value end end |
#to_hash ⇒ Hash
Hash representation of this Variable Node
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/steamd/nodes/variable_node.rb', line 34 def to_hash { name: name, type: type, modifier: nil, value: nil, size: size, modifier_size: nil } end |
#type ⇒ String
Returns the type of the variable
14 15 16 |
# File 'lib/steamd/nodes/variable_node.rb', line 14 def type var_type.type.text_value end |