Class: Resources::Statistics

Inherits:
BaseResource show all
Defined in:
lib/pvdgm-bs-client/resources/statistics.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#options, #prompter

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from BaseResource

Instance Method Details

#listObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pvdgm-bs-client/resources/statistics.rb', line 5

def list

  filter = Proc.new do | key |
    if options[:all_stats]
      true
    else
      not key =~ /(^cmd-|^max-|^pid|^version|^rusage|^binlog|^id)/
    end
  end

  result = get("beanstalk")
  puts "\nBeanstalk global statistics"
  table = Terminal::Table.new headings: [ 'Key', 'Value' ] do | t |
    result.keys.sort.each do | key |
      next unless filter.call(key)
      t << [ key, result[key] ]
    end
  end
  puts table
  puts
end