Module: Ronin::Model::TargetsArch
- Included in:
- Exploits::Target, Payloads::Encoders::Encoder, Payloads::Payload
- Defined in:
- lib/ronin/model/targets_arch.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ronin/model/targets_arch.rb', line 29 def self.included(base) base.module_eval do # The targeted architecture belongs_to :arch, :nullable => true # # The targeted architecture. # # @param [Symbol] name # If a name is given, a new Arch with the matching name will be # targeted. # # @return [Arch] # The architecture to target. # # @example Accessing the targeted architecture # target.arch # # => nil # # @example Setting the targeted architecture # target.arch :i686 # # => #<Ronin::Arch type=Ronin::Arch id=nil name="i686" # # endian="little" address_length=4> # def arch(name=nil) if name return self.arch = Arch[name] else return relationships[:arch].get(self) end end end model_name = base.name.split('::').last.snake_case.plural.to_sym Arch.has Arch.n, model_name, :model => base.name end |