Class: RMonitor::Commands::CL::List
- Inherits:
-
Object
- Object
- RMonitor::Commands::CL::List
- Defined in:
- lib/rmonitor/commands/cl/list.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ List
constructor
A new instance of List.
Constructor Details
#initialize(options = {}) ⇒ List
Returns a new instance of List.
7 8 9 10 11 |
# File 'lib/rmonitor/commands/cl/list.rb', line 7 def initialize( = {}) @out = [:out] || $stdout @list = [:list] || RMonitor::Commands::List.new() @matcher = [:matcher] || RMonitor::Matcher.new() end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rmonitor/commands/cl/list.rb', line 13 def execute profiles = @list.execute profiles.each do |profile| @out.write("#{profile[:name]}\t") if @matcher.invokable?(profile) @out.write("invokable") else @out.write("uninvokable") end profile[:devices].each do |device| @out.write("\t#{device[:name]}") if device[:mode] && device[:rate] @out.write(" (#{device[:mode]} #{device[:rate]})") elsif device[:mode] @out.write(" (#{device[:mode]})") elsif device[:rate] @out.write(" (#{device[:rate]})") end end @out.write("\n") end end |