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

VERSION =
'0.1'

Class Method Summary collapse

Class Method Details

.configure(settings) ⇒ Object



5
6
7
# File 'lib/activehistory.rb', line 5

def self.configure(settings)
  @@connection = ActiveHistory::Connection.new(settings)
end

.configured?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/activehistory.rb', line 9

def self.configured?
  class_variable_defined?(:@@connection)
end

.encapsulate(id_or_options = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/activehistory.rb', line 17

def self.encapsulate(id_or_options=nil)
  Thread.current[:activehistory_event] = id_or_options
  yield
ensure
  if Thread.current[:activehistory_event].is_a?(ActiveHistory::Event)
    Thread.current[:activehistory_event].save!
  end
  Thread.current[:activehistory_event] = nil
end

.urlObject



13
14
15
# File 'lib/activehistory.rb', line 13

def self.url
  @@connection.url
end