Class: DataSnapshots::Configuration
- Inherits:
-
Object
- Object
- DataSnapshots::Configuration
- Defined in:
- lib/data_snapshots/configuration.rb
Instance Attribute Summary collapse
-
#snapshots ⇒ Object
readonly
Returns the value of attribute snapshots.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_snapshot(name:, model: true) {|snapshots[name]| ... } ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 |
# File 'lib/data_snapshots/configuration.rb', line 7 def initialize @snapshots = {} end |
Instance Attribute Details
#snapshots ⇒ Object (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
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 |