Class: Flattery::ValueCache::Processor
- Inherits:
-
Object
- Object
- Flattery::ValueCache::Processor
- Defined in:
- lib/flattery/value_cache/processor.rb
Instance Method Summary collapse
-
#before_save(record) ⇒ Object
Command: updates cached values for related changed attributes.
-
#resolved_options!(klass) ⇒ Object
Command: resolves value cache options for
klass
if required, and returns resolved options.
Instance Method Details
#before_save(record) ⇒ Object
Command: updates cached values for related changed attributes
4 5 6 7 8 9 10 11 |
# File 'lib/flattery/value_cache/processor.rb', line 4 def before_save(record) (record.class).each do |key,| if record.changed & [:changed_on] record.send("#{key}=", record.send([:from_entity]).try(:send,[:to_entity])) end end true end |
#resolved_options!(klass) ⇒ Object
Command: resolves value cache options for klass
if required, and returns resolved options
14 15 16 |
# File 'lib/flattery/value_cache/processor.rb', line 14 def (klass) klass..settings end |