Module: Satellite

Defined in:
lib/satellite.rb,
lib/satellite/adapters/google_analytics.rb,
lib/satellite/adapters/google_analytics.rb,
lib/satellite/controllers/google_analytics.rb

Defined Under Namespace

Modules: Adapters, Controllers Classes: NoAdapterError, TrackerInterface

Class Method Summary collapse

Class Method Details

.create_tracker(type, params = { }) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/satellite.rb', line 54

def self.create_tracker(type, params = { })
  begin
    tracker_klass = "Satellite::Adapters::#{type.to_s.camelcase}".constantize
  rescue
    raise NoAdapterError, "There is no such adapter like 'Satellite::Adapters::#{type.to_s.camelcase}'"
  end

  TrackerInterface.new(tracker_klass.new(params))
end