Class: Blender3d::Structure
- Inherits:
-
Object
- Object
- Blender3d::Structure
- Defined in:
- lib/blender-3d/structure.rb
Class Attribute Summary collapse
-
.definition ⇒ Object
readonly
Returns the value of attribute definition.
Instance Method Summary collapse
- #deserialize(reader) ⇒ Object
-
#initialize(reader = nil) ⇒ Structure
constructor
A new instance of Structure.
Constructor Details
#initialize(reader = nil) ⇒ Structure
Returns a new instance of Structure.
7 8 9 |
# File 'lib/blender-3d/structure.rb', line 7 def initialize(reader = nil) deserialize(reader) if reader end |
Class Attribute Details
.definition ⇒ Object (readonly)
Returns the value of attribute definition.
4 5 6 |
# File 'lib/blender-3d/structure.rb', line 4 def definition @definition end |
Instance Method Details
#deserialize(reader) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/blender-3d/structure.rb', line 11 def deserialize(reader) self.class.definition.fields.each do |field| value = field.type.read(reader) instance_variable_set "@#{field.name}", value end self end |