Class: Cloudscopes::Process
- Inherits:
-
Object
- Object
- Cloudscopes::Process
- Defined in:
- lib/cloudscopes/process.rb
Defined Under Namespace
Classes: SystemProcess
Instance Method Summary collapse
Instance Method Details
#list ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/cloudscopes/process.rb', line 75 def list list = Dir["/proc/[0-9]*[0-9]"].collect{|dir| SystemProcess.new(File.basename(dir).to_i) } list.define_singleton_method(:method_missing) do |name, *args| case name.to_s when /^by_(.*)/ field = $1.to_sym raise ArgumentError.new("wrong number of arguments (#{args.length} for 1)") unless args.length == 1 select do |ps| case ps.send(field) when args.first true else false end end else raise NoMethodError.new("No such method #{name}",name) end end list end |