Module: Recorder

Defined in:
lib/recorder.rb,
lib/recorder/tape.rb,
lib/recorder/config.rb,
lib/recorder/version.rb,
lib/recorder/observer.rb,
lib/recorder/changeset.rb,
lib/recorder/rails/controller_concern.rb,
lib/recorder/sidekiq/revisions_worker.rb,
lib/generators/recorder/install_generator.rb

Defined Under Namespace

Modules: Observer, Rails, Sidekiq, VERSION Classes: Changeset, Config, InstallGenerator, Revision, Tape

Class Method Summary collapse

Class Method Details

.active_record_protected_attributes?Boolean

Returns a boolean indicating whether “protected attibutes” should be configured, e.g. attr_accessible.

Returns:

  • (Boolean)


39
40
41
# File 'lib/recorder.rb', line 39

def active_record_protected_attributes?
  @active_record_protected_attributes ||= !!defined?(ProtectedAttributes)
end

.config {|@config| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Recorder’s configuration object.

Yields:



45
46
47
48
49
# File 'lib/recorder.rb', line 45

def config
  @config ||= Recorder::Config.instance
  yield @config if block_given?
  @config
end

.enabled=(value) ⇒ Object

Switches Recorder on or off.



14
15
16
# File 'lib/recorder.rb', line 14

def enabled=(value)
  Recorder.config.enabled = value
end

.enabled?Boolean

Returns ‘true` if Recorder is on, `false` otherwise. Recorder is enabled by default.

Returns:

  • (Boolean)


21
22
23
# File 'lib/recorder.rb', line 21

def enabled?
  !!Recorder.config.enabled
end

.info=(hash) ⇒ Object

Sets Recorder information from the controller.



27
28
29
# File 'lib/recorder.rb', line 27

def info=(hash)
  self.store.merge!(hash)
end

.meta=(hash) ⇒ Object

Sets Recorder meta information.



33
34
35
# File 'lib/recorder.rb', line 33

def meta=(hash)
  self.store[:meta] = hash
end

.storeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Thread-safe hash to hold Recorder’s data.



58
59
60
# File 'lib/recorder.rb', line 58

def store
  RequestStore.store[:recorder] ||= { }
end

.versionObject

Returns version of Recorder as String



52
53
54
# File 'lib/recorder.rb', line 52

def version
  VERSION::STRING
end