Class: Counter::Cache::Counters::BufferCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/counter/cache/counters/buffer_counter.rb,
lib/counter/cache/counters/buffer_counter/key.rb,
lib/counter/cache/counters/buffer_counter/saver.rb,
lib/counter/cache/counters/buffer_counter/updater.rb,
lib/counter/cache/counters/buffer_counter/enqueuer.rb,
lib/counter/cache/counters/buffer_counter/relation_finder.rb

Defined Under Namespace

Classes: Enqueuer, Key, RelationFinder, Saver, Updater

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_object, options) ⇒ BufferCounter

Returns a new instance of BufferCounter.



10
11
12
13
# File 'lib/counter/cache/counters/buffer_counter.rb', line 10

def initialize(source_object, options)
  @options = Counter::Cache::OptionsParser.new(options)
  @source_object = source_object
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/counter/cache/counters/buffer_counter.rb', line 8

def options
  @options
end

#source_objectObject

Returns the value of attribute source_object.



8
9
10
# File 'lib/counter/cache/counters/buffer_counter.rb', line 8

def source_object
  @source_object
end

Instance Method Details

#save!(&block) ⇒ Object



19
20
21
# File 'lib/counter/cache/counters/buffer_counter.rb', line 19

def save!(&block)
  Saver.new(options).save!(&block)
end

#update(direction) ⇒ Object



15
16
17
# File 'lib/counter/cache/counters/buffer_counter.rb', line 15

def update(direction)
  Updater.new(source_object, options, self.class.name).update!(direction)
end