Class: Rack::Lilypad
- Inherits:
-
Object
- Object
- Rack::Lilypad
- Defined in:
- lib/rack/lilypad.rb,
lib/rack/lilypad/rails.rb
Defined Under Namespace
Modules: Rails Classes: Hoptoad
Instance Attribute Summary collapse
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#log ⇒ Object
Returns the value of attribute log.
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, api_key = nil) {|_self| ... } ⇒ Lilypad
constructor
A new instance of Lilypad.
Constructor Details
#initialize(app, api_key = nil) {|_self| ... } ⇒ Lilypad
Returns a new instance of Lilypad.
11 12 13 14 15 16 17 18 |
# File 'lib/rack/lilypad.rb', line 11 def initialize(app, api_key = nil) @app = app @filters = [] @log = false yield self if block_given? @filters.flatten! @@hoptoad = @hoptoad = Hoptoad.new(api_key, @filters, @log) end |
Instance Attribute Details
#filters ⇒ Object
Returns the value of attribute filters.
8 9 10 |
# File 'lib/rack/lilypad.rb', line 8 def filters @filters end |
#log ⇒ Object
Returns the value of attribute log.
9 10 11 |
# File 'lib/rack/lilypad.rb', line 9 def log @log end |
Class Method Details
.notify(e) ⇒ Object
34 35 36 |
# File 'lib/rack/lilypad.rb', line 34 def notify(e) @@hoptoad.post(e) end |
.production? ⇒ Boolean
38 39 40 |
# File 'lib/rack/lilypad.rb', line 38 def production? %w(staging production).include?(ENV['RACK_ENV']) end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rack/lilypad.rb', line 20 def call(env) status, headers, body = begin @app.call(env) rescue Exception => e @hoptoad.post(e, env) raise end @hoptoad.post(env['rack.exception'], env) if env['rack.exception'] [ status, headers, body ] end |