Class: McDump::Memcached::Stat

Inherits:
Object
  • Object
show all
Defined in:
lib/mc_dump/memcached/stat.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Stat

Returns a new instance of Stat.


12
13
14
15
# File 'lib/mc_dump/memcached/stat.rb', line 12

def initialize(args)
  @items_id = args[:items_id]
  @number   = args[:number]
end

Class Method Details

.parse(dump) ⇒ Object


6
7
8
9
10
# File 'lib/mc_dump/memcached/stat.rb', line 6

def self.parse(dump)
  dump.scan(/STAT items:(\d+):number (\d+)/).map do |data|
    self.new(items_id: data[0], number: data[1])
  end
end

Instance Method Details

#items(telnet_session) ⇒ Object


17
18
19
# File 'lib/mc_dump/memcached/stat.rb', line 17

def items(telnet_session)
  McDump::Memcached::Item.parse(telnet_session.items(@items_id, @number), @items_id)
end