Sha256: 2b047f132f9febbcfbd50b5b9b0fa0a9e7980bc2d4d31e3965e6272d41235ef6

Contents?: true

Size: 563 Bytes

Versions: 18

Compression:

Stored size: 563 Bytes

Contents

require 'liquid/tracker/json_serializer'

module Tracker
  class Base
    attr_accessor :dimensions

    def initialize(dimensions = {})
      @dimensions = dimensions
    end

    def with_topic(topic, serializer = nil)
      Topic.new(topic, self, serializer)
    end
  end

  class Topic
    def initialize(topic, tracker, serializer = nil)
      @topic = topic
      @tracker = tracker
      @serializer = (serializer || JsonSerializer).new(tracker.dimensions)
    end

    def event(obj)
      @tracker.event(@topic, @serializer.dump(obj))
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
liquid-ext-3.5.0 lib/liquid/tracker/base.rb
liquid-ext-3.4.2 lib/liquid/tracker/base.rb
liquid-ext-3.4.1 lib/liquid/tracker/base.rb
liquid-ext-3.4.0 lib/liquid/tracker/base.rb
liquid-ext-3.3.10 lib/liquid/tracker/base.rb
liquid-ext-3.3.9 lib/liquid/tracker/base.rb
liquid-ext-3.3.8 lib/liquid/tracker/base.rb
liquid-ext-3.3.7 lib/liquid/tracker/base.rb
liquid-ext-3.3.6 lib/liquid/tracker/base.rb
liquid-ext-3.3.5 lib/liquid/tracker/base.rb
liquid-ext-3.3.4 lib/liquid/tracker/base.rb
liquid-ext-3.3.3 lib/liquid/tracker/base.rb
liquid-ext-3.3.2 lib/liquid/tracker/base.rb
liquid-ext-3.3.0 lib/liquid/tracker/base.rb
liquid-ext-3.2.0 lib/liquid/tracker/base.rb
liquid-ext-3.1.2 lib/liquid/tracker/base.rb
liquid-ext-3.1.1 lib/liquid/tracker/base.rb
liquid-ext-3.1.0 lib/liquid/tracker/base.rb