Module: Wonkavision::Plugins::Facts::InstanceMethods
- Defined in:
- lib/wonkavision/plugins/analytics/facts.rb
Instance Method Summary collapse
- #accept_event(event_data, options = {}) ⇒ Object
- #add_facts(data) ⇒ Object
- #reject_facts(data) ⇒ Object
- #update_facts(data) ⇒ Object
Instance Method Details
#accept_event(event_data, options = {}) ⇒ Object
59 60 61 62 |
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 59 def accept_event(event_data, ={}) action = [:action] || :add send "#{action}_facts", event_data end |
#add_facts(data) ⇒ Object
74 75 76 77 |
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 74 def add_facts(data) current_facts = store ? store.add_facts(data) : data process_facts current_facts, "add" if current_facts end |
#reject_facts(data) ⇒ Object
79 80 81 82 |
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 79 def reject_facts(data) previous_facts = store ? store.remove_facts(data) : data process_facts previous_facts, "reject" if previous_facts end |
#update_facts(data) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/wonkavision/plugins/analytics/facts.rb', line 64 def update_facts(data) raise "A persistent store must be configured in order to update facts" unless store previous_facts, current_facts = store.update_facts(data) unless previous_facts == current_facts process_facts previous_facts, "reject" if previous_facts process_facts current_facts, "add" if current_facts end end |