Class: Oxidized::Node::Stats
- Inherits:
-
Object
- Object
- Oxidized::Node::Stats
- Defined in:
- lib/oxidized/node/stats.rb
Constant Summary collapse
- MAX_STAT =
10
Instance Method Summary collapse
- #add(job) ⇒ void
-
#get(status = nil) ⇒ Hash, Array
Hash of stats for every status or Array of stats for specific status.
Instance Method Details
#add(job) ⇒ void
This method returns an undefined value.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/oxidized/node/stats.rb', line 8 def add job stat = { :start => job.start, :end => job.end, :time => job.time, } @stats[job.status] ||= [] @stats[job.status].shift if @stats[job.status].size > MAX_STAT @stats[job.status].push stat end |
#get(status = nil) ⇒ Hash, Array
Returns Hash of stats for every status or Array of stats for specific status.
21 22 23 |
# File 'lib/oxidized/node/stats.rb', line 21 def get status=nil status ? @stats[status] : @stats end |