Module: Wonkavision::Plugins::Facts::ClassMethods

Defined in:
lib/wonkavision/plugins/analytics/facts.rb

Instance Method Summary collapse

Instance Method Details

#accept(event_path, options = {}, &mapping_block) ⇒ Object



26
27
28
29
30
31
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 26

def accept(event_path, options={}, &mapping_block)
  map(event_path, &mapping_block) if mapping_block
  handle event_path do
    accept_event(event_context.data, options)
  end
end

#output_event_path(new_path = nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 17

def output_event_path(new_path=nil)
  if new_path
    facts_options[:output_event_path] = new_path
  else
    facts_options[:output_event_path] ||=
      Wonkavision.join('wv','analytics','facts','updated')
  end
end

#record_id(new_record_id = nil) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 33

def record_id(new_record_id=nil)
  if new_record_id
    facts_options[:record_id] = new_record_id
  else
    facts_options[:record_id] ||= "id"
  end
end

#store(new_store = nil) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 41

def store(new_store=nil)
  if new_store
    store = new_store.kind_of?(Wonkavision::Analytics::Persistence::Store) ? store :
      Wonkavision::Analytics::Persistence::Store[new_store]

    raise "Could not find a storage type of #{new_store}" unless store

    store = store.new(self) if store.respond_to?(:new)

    facts_options[:store] = store
  else
    facts_options[:store]
  end
end