Class: Impressionist::UpdateCounters
- Inherits:
-
Object
- Object
- Impressionist::UpdateCounters
- Defined in:
- lib/impressionist/update_counters.rb
Instance Attribute Summary collapse
-
#master ⇒ Object
readonly
Returns the value of attribute master.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
Instance Method Summary collapse
-
#initialize(receiver) ⇒ UpdateCounters
constructor
A new instance of UpdateCounters.
- #update ⇒ Object
Constructor Details
#initialize(receiver) ⇒ UpdateCounters
Returns a new instance of UpdateCounters.
5 6 7 8 |
# File 'lib/impressionist/update_counters.rb', line 5 def initialize(receiver) @receiver = receiver @master = receiver.class end |
Instance Attribute Details
#master ⇒ Object (readonly)
Returns the value of attribute master.
3 4 5 |
# File 'lib/impressionist/update_counters.rb', line 3 def master @master end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
3 4 5 |
# File 'lib/impressionist/update_counters.rb', line 3 def receiver @receiver end |
Instance Method Details
#update ⇒ Object
10 11 12 13 14 15 |
# File 'lib/impressionist/update_counters.rb', line 10 def update result = (impressions_total - impressions_cached) master. update_counters(id, column_name => result) end |