Module: Ronin::Model::TargetsArch::ClassMethods

Defined in:
lib/ronin/model/targets_arch.rb

Instance Method Summary collapse

Instance Method Details

#targeting_arch(arch) ⇒ DataMapper::Collection

Queries all resources targeting a specific Architecture.

Since:

  • 1.0.0


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ronin/model/targets_arch.rb', line 60

def targeting_arch(arch)
  conditions = case arch
               when Arch, Hash
                 {arch: arch}
               when Symbol
                 unless Arch.methods(false).include?(arch)
                   raise(ArgumentError,"unknown arch: #{arch}")
                 end

                 {arch: Arch.send(arch)}
               else
                 {'arch.name' => arch.to_s}
               end

  all(conditions)
end