Class: Roma::Client::Stats

Inherits:
Hash
  • Object
show all
Defined in:
lib/roma/client/stats.rb

Overview

TODO: Implement accessors and return values with correct type Now: client.stats #=> “2” Better: client.stats.routing.redundant #=> 2

Instance Method Summary collapse

Constructor Details

#initialize(stats_str) ⇒ Stats

Returns a new instance of Stats.



7
8
9
10
11
12
13
14
# File 'lib/roma/client/stats.rb', line 7

def initialize(stats_str)
  stats_str.each_line do |line|
    line =~ /^(.+?)\s(.+)/
    key = Regexp.last_match(1)
    value = Regexp.last_match(2).chomp
    self[key] = value
  end
end