Class: FFI::Generators::Structures::Field
- Inherits:
-
Object
- Object
- FFI::Generators::Structures::Field
- Defined in:
- lib/ffi2/generators/structures.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.
44 45 46 47 48 49 |
# File 'lib/ffi2/generators/structures.rb', line 44 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.
39 40 41 |
# File 'lib/ffi2/generators/structures.rb', line 39 def name @name end |
#offset ⇒ Object
Returns the value of attribute offset.
41 42 43 |
# File 'lib/ffi2/generators/structures.rb', line 41 def offset @offset end |
#size ⇒ Object
Returns the value of attribute size.
42 43 44 |
# File 'lib/ffi2/generators/structures.rb', line 42 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
40 41 42 |
# File 'lib/ffi2/generators/structures.rb', line 40 def type @type end |
Instance Method Details
#to_config(name) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/ffi2/generators/structures.rb', line 55 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 |