Module: Totango::Resource::ClassMethods
- Defined in:
- lib/totango/resource.rb
Instance Method Summary collapse
- #sp_default(key, val) ⇒ Object
- #sp_trackers ⇒ Object
-
#track(action, *opts) ⇒ Object
- action<Symbol>
- Action to track opts<Hash>
-
Override defaults and set conditional tracking.
Instance Method Details
#sp_default(key, val) ⇒ Object
15 16 17 18 19 |
# File 'lib/totango/resource.rb', line 15 def sp_default(key, val) raise ArgumentError, "Key #{key.inspect} is not a valid option" unless @sp_defaults.keys.member?(key) sp_defaults[key] = val end |
#sp_trackers ⇒ Object
28 29 30 |
# File 'lib/totango/resource.rb', line 28 def sp_trackers @__sp_trackers__ ||= [] end |
#track(action, *opts) ⇒ Object
- action<Symbol>
-
Action to track
- opts<Hash>
-
Override defaults and set conditional tracking
23 24 25 26 |
# File 'lib/totango/resource.rb', line 23 def track(action, *opts) tracker = Totango::Tracker.new(action, *opts) sp_trackers << tracker unless sp_trackers.find {|t| t.action.to_s == action.to_s} end |