Sha256: e063c2bdbd9be7484d5debf95cf340e86df43b132d94430c07978c64972f5f51

Contents?: true

Size: 697 Bytes

Versions: 5

Compression:

Stored size: 697 Bytes

Contents

class Rack::Tracker::Handler
  class_attribute :position
  self.position = :head

  attr_accessor :options
  attr_accessor :env

  def initialize(env, options = {})
    self.env = env
    self.options  = options
    self.position = options[:position] if options.has_key?(:position)
  end

  def events
    events = env.fetch('tracker', {})[self.class.to_s.demodulize.underscore] || []
    events.map{ |ev| "#{self.class}::#{ev['class_name']}".constantize.new(ev.except('class_name')) }
  end

  def render
    raise NotImplementedError.new('needs implementation')
  end

  def self.track(name, event)
    raise NotImplementedError.new("class method `#{__callee__}` is not implemented.")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-tracker-1.0.1 lib/rack/tracker/handler.rb
rack-tracker-1.0.0 lib/rack/tracker/handler.rb
rack-tracker-0.4.2 lib/rack/tracker/handler.rb
rack-tracker-0.4.1 lib/rack/tracker/handler.rb
rack-tracker-0.4.0 lib/rack/tracker/handler.rb