Class: FFI::StructGenerator::Field
- Inherits:
-
Object
- Object
- FFI::StructGenerator::Field
- Defined in:
- lib/ffi/tools/struct_generator.rb
Overview
A field in a Struct.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#size ⇒ Object
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type) ⇒ Field
constructor
A new instance of Field.
- #to_config(name) ⇒ Object
Constructor Details
#initialize(name, type) ⇒ Field
Returns a new instance of Field.
173 174 175 176 177 178 |
# File 'lib/ffi/tools/struct_generator.rb', line 173 def initialize(name, type) @name = name @type = type @offset = nil @size = nil end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
168 169 170 |
# File 'lib/ffi/tools/struct_generator.rb', line 168 def name @name end |
#offset ⇒ Object
Returns the value of attribute offset.
170 171 172 |
# File 'lib/ffi/tools/struct_generator.rb', line 170 def offset @offset end |
#size ⇒ Object
Returns the value of attribute size.
171 172 173 |
# File 'lib/ffi/tools/struct_generator.rb', line 171 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
169 170 171 |
# File 'lib/ffi/tools/struct_generator.rb', line 169 def type @type end |
Instance Method Details
#to_config(name) ⇒ Object
184 185 186 187 188 189 190 |
# File 'lib/ffi/tools/struct_generator.rb', line 184 def to_config(name) buf = [] buf << "rbx.platform.#{name}.#{@name}.offset = #{@offset}" buf << "rbx.platform.#{name}.#{@name}.size = #{@size}" buf << "rbx.platform.#{name}.#{@name}.type = #{@type}" if @type buf end |