Class: TurboRex::CStruct::NativeStructProxy
- Inherits:
-
Object
- Object
- TurboRex::CStruct::NativeStructProxy
- Defined in:
- lib/turborex/cstruct.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#sizeof ⇒ Object
readonly
Returns the value of attribute sizeof.
-
#struct ⇒ Object
readonly
Returns the value of attribute struct.
Instance Method Summary collapse
- #from_str(str, offset = 0) ⇒ Object
-
#initialize(parser, name) ⇒ NativeStructProxy
constructor
A new instance of NativeStructProxy.
- #method_missing(m, *args, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(parser, name) ⇒ NativeStructProxy
Returns a new instance of NativeStructProxy.
545 546 547 548 549 |
# File 'lib/turborex/cstruct.rb', line 545 def initialize(parser, name) @parser = parser @name = name @size = @sizeof = parser.sizeof(parser.find_c_struct(name)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
560 561 562 |
# File 'lib/turborex/cstruct.rb', line 560 def method_missing(m, *args, &block) @struct.send(m, *args, &block) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
542 543 544 |
# File 'lib/turborex/cstruct.rb', line 542 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
540 541 542 |
# File 'lib/turborex/cstruct.rb', line 540 def size @size end |
#sizeof ⇒ Object (readonly)
Returns the value of attribute sizeof.
541 542 543 |
# File 'lib/turborex/cstruct.rb', line 541 def sizeof @sizeof end |
#struct ⇒ Object (readonly)
Returns the value of attribute struct.
543 544 545 |
# File 'lib/turborex/cstruct.rb', line 543 def struct @struct end |
Instance Method Details
#from_str(str, offset = 0) ⇒ Object
551 552 553 554 |
# File 'lib/turborex/cstruct.rb', line 551 def from_str(str, offset = 0) struct = @parser.find_c_struct(@name) @struct = ::Metasm::C::AllocCStruct.new(@parser, struct, str, offset) end |
#to_s ⇒ Object
556 557 558 |
# File 'lib/turborex/cstruct.rb', line 556 def to_s @struct.str end |