Class: TheTracker::Tracker
- Inherits:
-
Object
- Object
- TheTracker::Tracker
- Includes:
- Singleton
- Defined in:
- lib/the_tracker/tracker.rb
Overview
Common tracker behaviour
Class Method Summary collapse
Instance Method Summary collapse
-
#add(tracker) ⇒ Object
register a new tracker.
-
#add_once(tracker) ⇒ Object
register a new one time only tracker.
-
#body_bottom ⇒ Object
Return body bottom content for all registered trackers.
-
#body_top ⇒ Object
Return body top content for all registered trackers.
-
#header ⇒ Object
Return header content for all registered trackers.
-
#trackers ⇒ Object
registered trackers.
Class Method Details
.config {|self.instance| ... } ⇒ Object
8 9 10 |
# File 'lib/the_tracker/tracker.rb', line 8 def self.config yield self.instance if block_given? end |
Instance Method Details
#add(tracker) ⇒ Object
register a new tracker
13 14 15 |
# File 'lib/the_tracker/tracker.rb', line 13 def add(tracker) regular_trackers[tracker.name] = tracker end |
#add_once(tracker) ⇒ Object
register a new one time only tracker
18 19 20 |
# File 'lib/the_tracker/tracker.rb', line 18 def add_once(tracker) one_time_trackers[tracker.name] = tracker end |
#body_bottom ⇒ Object
Return body bottom content for all registered trackers
38 39 40 41 42 |
# File 'lib/the_tracker/tracker.rb', line 38 def body_bottom trk_result = show_trackers_for(:body_bottom) remove_one_time_trackers return trk_result end |
#body_top ⇒ Object
Return body top content for all registered trackers
33 34 35 |
# File 'lib/the_tracker/tracker.rb', line 33 def body_top show_trackers_for(:body_top) end |
#header ⇒ Object
Return header content for all registered trackers
28 29 30 |
# File 'lib/the_tracker/tracker.rb', line 28 def header show_trackers_for(:header) end |
#trackers ⇒ Object
registered trackers
23 24 25 |
# File 'lib/the_tracker/tracker.rb', line 23 def trackers one_time_trackers.empty? ? regular_trackers : regular_trackers.merge(one_time_trackers) end |