Sha256: deb1c497535c157846cdac092db3d7d41f0a2b8f76be72577ec3ff61ace705ec

Contents?: true

Size: 490 Bytes

Versions: 29

Compression:

Stored size: 490 Bytes

Contents

module TreasureData
module Logger
module Agent::Rack

  class Hook
    @@before = []
    @@after = []

    def self.before(&block)
      @@before << block
    end

    def self.after(&block)
      @@after << block
    end

    def initialize(app, options={})
      @app = app
    end

    def call(env)
      @@before.each {|m|
        m.call(env)
      }

      result = @app.call(env)

      @@after.each {|m|
        m.call(env, result)
      }

      result
    end
  end

end
end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
td-logger-0.3.28 lib/td/logger/agent/rack.rb
td-logger-0.3.27 lib/td/logger/agent/rack.rb
td-logger-0.3.26 lib/td/logger/agent/rack.rb
td-logger-0.3.25 lib/td/logger/agent/rack.rb
td-logger-0.3.24 lib/td/logger/agent/rack.rb
td-logger-0.3.23 lib/td/logger/agent/rack.rb
td-logger-0.3.22 lib/td/logger/agent/rack.rb
td-logger-0.3.21 lib/td/logger/agent/rack.rb
td-logger-0.3.20 lib/td/logger/agent/rack.rb
td-logger-0.3.19 lib/td/logger/agent/rack.rb
td-logger-0.3.18 lib/td/logger/agent/rack.rb
td-logger-0.3.17 lib/td/logger/agent/rack.rb
td-logger-0.3.16 lib/td/logger/agent/rack.rb
td-logger-0.3.15 lib/td/logger/agent/rack.rb
td-logger-0.3.14 lib/td/logger/agent/rack.rb
td-logger-0.3.13 lib/td/logger/agent/rack.rb
td-logger-0.3.12 lib/td/logger/agent/rack.rb
td-logger-0.3.11 lib/td/logger/agent/rack.rb
td-logger-0.3.10 lib/td/logger/agent/rack.rb
td-logger-0.3.9 lib/td/logger/agent/rack.rb