Class: Counter::Cache::OptionsParser

Inherits:
Struct
  • Object
show all
Defined in:
lib/counter/cache/options_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



3
4
5
# File 'lib/counter/cache/options_parser.rb', line 3

def options
  @options
end

Instance Method Details

#cached?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/counter/cache/options_parser.rb', line 40

def cached?
  option_or_true options[:cache]
end

#columnObject



12
13
14
# File 'lib/counter/cache/options_parser.rb', line 12

def column
  options[:column]
end

#if_valueObject



52
53
54
# File 'lib/counter/cache/options_parser.rb', line 52

def if_value
  options[:if]
end

#increment_byObject



36
37
38
# File 'lib/counter/cache/options_parser.rb', line 36

def increment_by
  options[:increment_by]
end

#methodObject



32
33
34
# File 'lib/counter/cache/options_parser.rb', line 32

def method
  options[:method]
end

#polymorphic?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/counter/cache/options_parser.rb', line 48

def polymorphic?
  options[:polymorphic]
end

#recalculation?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/counter/cache/options_parser.rb', line 44

def recalculation?
  option_or_true options[:recalculation]
end

#recalculation_delayObject



65
66
67
# File 'lib/counter/cache/options_parser.rb', line 65

def recalculation_delay
  options[:recalculation_delay] || Counter::Cache.configuration.recalculation_delay
end

#relationObject



20
21
22
# File 'lib/counter/cache/options_parser.rb', line 20

def relation
  options[:relation]
end

#relation_class_nameObject



24
25
26
# File 'lib/counter/cache/options_parser.rb', line 24

def relation_class_name
  options[:relation_class_name]
end

#relation_idObject



28
29
30
# File 'lib/counter/cache/options_parser.rb', line 28

def relation_id
  options[:relation_id]
end

#source_object_class_nameObject



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

def source_object_class_name
  options[:source_object_class_name]
end

#touch_columnObject



16
17
18
# File 'lib/counter/cache/options_parser.rb', line 16

def touch_column
  options[:touch_column]
end

#wait(source_object) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/counter/cache/options_parser.rb', line 56

def wait(source_object)
  wait = options[:wait]
  if wait.respond_to?(:call)
    wait.call(source_object)
  else
    wait
  end
end

#worker_adapterObject



4
5
6
# File 'lib/counter/cache/options_parser.rb', line 4

def worker_adapter
  options[:worker_adapter] || Counter::Cache.configuration.default_worker_adapter
end