Class: Rex::MachParsey::GenericStruct
- Inherits:
-
Object
- Object
- Rex::MachParsey::GenericStruct
- Defined in:
- lib/rex/machparsey/machbase.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#struct ⇒ Object
Returns the value of attribute struct.
Instance Method Summary collapse
-
#[](*args) ⇒ Object
Access a value by array.
-
#initialize(_struct) ⇒ GenericStruct
constructor
A new instance of GenericStruct.
-
#keys ⇒ Object
Obtain an array of all fields.
- #method_missing(meth, *args) ⇒ Object
-
#v ⇒ Object
Access a value.
Constructor Details
#initialize(_struct) ⇒ GenericStruct
Returns a new instance of GenericStruct.
13 14 15 |
# File 'lib/rex/machparsey/machbase.rb', line 13 def initialize(_struct) self.struct = _struct end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
32 33 34 |
# File 'lib/rex/machparsey/machbase.rb', line 32 def method_missing(meth, *args) v[meth.to_s] || (raise NoMethodError.new, meth) end |
Instance Attribute Details
#struct ⇒ Object
Returns the value of attribute struct.
12 13 14 |
# File 'lib/rex/machparsey/machbase.rb', line 12 def struct @struct end |
Instance Method Details
#[](*args) ⇒ Object
Access a value by array
23 24 25 |
# File 'lib/rex/machparsey/machbase.rb', line 23 def [](*args) struct[*args] end |
#keys ⇒ Object
Obtain an array of all fields
28 29 30 |
# File 'lib/rex/machparsey/machbase.rb', line 28 def keys struct.keys end |
#v ⇒ Object
Access a value
18 19 20 |
# File 'lib/rex/machparsey/machbase.rb', line 18 def v struct.v end |