Class: Qtrix::Matrix::Reader
Overview
Class responsible for reading & returning the persistent state of the matrix.
Constant Summary
Constants included
from Common
Common::REDIS_KEY
Class Method Summary
collapse
Methods included from Common
included, #pack, #unpack
#extract_args, included, #redis, #redis_namespace
Class Method Details
.fetch(namespace = :current) ⇒ Object
12
13
14
|
# File 'lib/qtrix/matrix/reader.rb', line 12
def self.fetch(namespace=:current)
redis(namespace).lrange(REDIS_KEY, 0, -1).map{|dump| unpack(dump)}
end
|
.rows_for_host(hostname, namespace = :current) ⇒ Object
20
21
22
|
# File 'lib/qtrix/matrix/reader.rb', line 20
def self.rows_for_host(hostname, namespace=:current)
fetch(namespace).select{|row| row.hostname == hostname}
end
|
.to_table(namespace = :current) ⇒ Object
16
17
18
|
# File 'lib/qtrix/matrix/reader.rb', line 16
def self.to_table(namespace=:current)
fetch(namespace).map{|row| row.entries.map(&:queue)}
end
|