Class: DataSnapshots::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/data_snapshots/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
# File 'lib/data_snapshots/configuration.rb', line 7

def initialize
  @snapshots = {}
end

Instance Attribute Details

#snapshotsObject (readonly)

Returns the value of attribute snapshots.



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

def snapshots
  @snapshots
end

Instance Method Details

#register_snapshot(name:, model: true) {|snapshots[name]| ... } ⇒ Object

Yields:



11
12
13
14
15
# File 'lib/data_snapshots/configuration.rb', line 11

def register_snapshot(name:, model: true)
  return unless block_given?
  snapshots[name] = { methods: {}, model: model }
  yield snapshots[name][:methods]
end