Sha256: 54544000300dd52e670dd26a593351dc9a83b054a5b1b92a26756f11661ca677

Contents?: true

Size: 604 Bytes

Versions: 2

Compression:

Stored size: 604 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)
      log_entry = @serializer.dump(obj)
      @tracker.event(@topic, log_entry) if log_entry
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
liquid-ext-3.5.3 lib/liquid/tracker/base.rb
liquid-ext-3.5.2 lib/liquid/tracker/base.rb