Class: DRbQS::History
- Inherits:
-
Object
- Object
- DRbQS::History
- Defined in:
- lib/drbqs/history.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #events(id) ⇒ Object
-
#initialize ⇒ History
constructor
A new instance of History.
- #number_of_events(id) ⇒ Object
- #set(id, *args) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ History
Returns a new instance of History.
10 11 12 |
# File 'lib/drbqs/history.rb', line 10 def initialize @data = Hash.new { |h, k| h[k] = Array.new } end |
Instance Method Details
#each(&block) ⇒ Object
30 31 32 |
# File 'lib/drbqs/history.rb', line 30 def each(&block) @data.each(&block) end |
#events(id) ⇒ Object
22 23 24 |
# File 'lib/drbqs/history.rb', line 22 def events(id) @data[id] end |
#number_of_events(id) ⇒ Object
26 27 28 |
# File 'lib/drbqs/history.rb', line 26 def number_of_events(id) @data[id].size end |
#set(id, *args) ⇒ Object
14 15 16 |
# File 'lib/drbqs/history.rb', line 14 def set(id, *args) @data[id] << [Time.now] + args end |
#size ⇒ Object
18 19 20 |
# File 'lib/drbqs/history.rb', line 18 def size @data.size end |