Module: ActiveRecord::Bitemporal::Optionable

Included in:
ActiveRecord::Bitemporal, Persistence::PersistenceOptionable
Defined in:
lib/activerecord-bitemporal/bitemporal.rb

Instance Method Summary collapse

Instance Method Details

#bitemporal_optionObject



9
10
11
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 9

def bitemporal_option
  ::ActiveRecord::Bitemporal.merge_by(bitemporal_option_storage)
end

#bitemporal_option_merge!(other) ⇒ Object



13
14
15
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 13

def bitemporal_option_merge!(other)
  self.bitemporal_option_storage = bitemporal_option.merge other
end

#with_bitemporal_option(**opt) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 17

def with_bitemporal_option(**opt)
  tmp_opt = bitemporal_option_storage
  self.bitemporal_option_storage = tmp_opt.merge(opt)
  yield self
ensure
  self.bitemporal_option_storage = tmp_opt
end