Class: Rex::MachParsey::GenericStruct

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/machparsey/machbase.rb

Direct Known Subclasses

GenericHeader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_struct) ⇒ GenericStruct

Returns a new instance of GenericStruct.



14
15
16
# File 'lib/rex/machparsey/machbase.rb', line 14

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



33
34
35
# File 'lib/rex/machparsey/machbase.rb', line 33

def method_missing(meth, *args)
	v[meth.to_s] || (raise NoMethodError.new, meth)
end

Instance Attribute Details

#structObject

Returns the value of attribute struct.



13
14
15
# File 'lib/rex/machparsey/machbase.rb', line 13

def struct
  @struct
end

Instance Method Details

#[](*args) ⇒ Object

Access a value by array



24
25
26
# File 'lib/rex/machparsey/machbase.rb', line 24

def [](*args)
	struct[*args]
end

#keysObject

Obtain an array of all fields



29
30
31
# File 'lib/rex/machparsey/machbase.rb', line 29

def keys
	struct.keys
end

#vObject

Access a value



19
20
21
# File 'lib/rex/machparsey/machbase.rb', line 19

def v
	struct.v
end