Class: DRbQS::Server::History
- Inherits:
-
Object
- Object
- DRbQS::Server::History
show all
- Includes:
- Misc
- Defined in:
- lib/drbqs/server/history.rb
Overview
This class is used in DRbQS::Server::NodeList and DRbQS::Server::Queue to save some histories.
Constant Summary
Constants included
from Misc
Misc::STRINGS_FOR_KEY
Instance Method Summary
collapse
Methods included from Misc
create_logger, create_uri, output_error, process_running_normally?, random_key, time_to_history_string, time_to_history_string2, uri_drbunix
Constructor Details
Returns a new instance of History.
8
9
10
|
# File 'lib/drbqs/server/history.rb', line 8
def initialize
@data = Hash.new { |h, k| h[k] = Array.new }
end
|
Instance Method Details
#each(&block) ⇒ Object
28
29
30
|
# File 'lib/drbqs/server/history.rb', line 28
def each(&block)
@data.each(&block)
end
|
#events(id) ⇒ Object
20
21
22
|
# File 'lib/drbqs/server/history.rb', line 20
def events(id)
@data[id]
end
|
#number_of_events(id) ⇒ Object
24
25
26
|
# File 'lib/drbqs/server/history.rb', line 24
def number_of_events(id)
@data[id].size
end
|
#set(id, *args) ⇒ Object
12
13
14
|
# File 'lib/drbqs/server/history.rb', line 12
def set(id, *args)
@data[id] << args.unshift(Time.now)
end
|
#size ⇒ Object
16
17
18
|
# File 'lib/drbqs/server/history.rb', line 16
def size
@data.size
end
|