Module: ActiveHistory
- Defined in:
- lib/activehistory.rb,
lib/activehistory/version.rb,
lib/activehistory/exceptions.rb
Defined Under Namespace
Modules: Adapter
Classes: Action, Connection, Event, Exception, Regard
Constant Summary
collapse
- UUIDV4 =
/^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
- VERSION =
'0.2'
Class Method Summary
collapse
Class Method Details
7
8
9
|
# File 'lib/activehistory.rb', line 7
def self.configure(settings)
@@connection = ActiveHistory::Connection.new(settings)
end
|
11
12
13
|
# File 'lib/activehistory.rb', line 11
def self.configured?
class_variable_defined?(:@@connection) && !@@connection.nil?
end
|
.current_event(timestamp: nil) ⇒ Object
36
37
38
|
# File 'lib/activehistory.rb', line 36
def self.current_event(timestamp: nil)
Thread.current[:activehistory_event]
end
|
.encapsulate(attributes_or_event = {}, &block) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/activehistory.rb', line 19
def self.encapsulate(attributes_or_event={}, &block)
if attributes_or_event.is_a?(ActiveHistory::Event)
event = attributes_or_event
else
event = ActiveHistory::Event.new(attributes_or_event)
end
Thread.current[:activehistory_event] = event
yield
ensure
if Thread.current[:activehistory_event] && !Thread.current[:activehistory_event].actions.empty?
Thread.current[:activehistory_event].save!
end
Thread.current[:activehistory_event] = nil
end
|
.url ⇒ Object
15
16
17
|
# File 'lib/activehistory.rb', line 15
def self.url
@@connection.url
end
|