Module: YandexMetrica

Defined in:
lib/yandex-metrica-rails.rb,
lib/yandex-metrica/counter.rb,
lib/yandex-metrica/version.rb,
lib/yandex-metrica/counter/kind.rb,
lib/yandex-metrica/counter/renderer.rb,
lib/yandex-metrica/counter/template_options.rb

Defined Under Namespace

Modules: Rails Classes: Counter

Constant Summary collapse

DEFAULTS =
{
  webvisor: true,
  clickmap: true,
  trackLinks: true
}
VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.add_counter(counter) ⇒ Object



32
33
34
35
# File 'lib/yandex-metrica-rails.rb', line 32

def add_counter(counter)
  @options ||= {}
  @options[counter] = true
end

.counterObject



12
13
14
# File 'lib/yandex-metrica-rails.rb', line 12

def counter
  @counter || nil
end

.counter=(counter) ⇒ Object



16
17
18
# File 'lib/yandex-metrica-rails.rb', line 16

def counter=(counter)
  @counter = counter
end

.invalid_counter?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/yandex-metrica-rails.rb', line 24

def invalid_counter?
  counter.nil? || counter == ""
end

.optionsObject



37
38
39
# File 'lib/yandex-metrica-rails.rb', line 37

def options
  @options ||= DEFAULTS
end

.reset!Object



41
42
43
# File 'lib/yandex-metrica-rails.rb', line 41

def reset!
  @options = nil
end

.set_counters(*counters) ⇒ Object



28
29
30
# File 'lib/yandex-metrica-rails.rb', line 28

def set_counters(*counters)
  counters.each{|c| add_counter(c)}
end

.valid_counter?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/yandex-metrica-rails.rb', line 20

def valid_counter?
  !invalid_counter?
end