Class: Rack::Plaid
- Inherits:
-
Object
- Object
- Rack::Plaid
- Defined in:
- lib/plaid-rails.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Plaid
constructor
A new instance of Plaid.
Constructor Details
#initialize(app) ⇒ Plaid
Returns a new instance of Plaid.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/plaid-rails.rb', line 29 def initialize(app) @app = app @queue = Queue.new if ENV['PLAID_MESSENGER'] == 'off' puts 'Plaid thread disabled. ' \ 'No information will be sent to the Plaid server.' else Thread.new do loop do RestClient.put PLAID_SERVER, @queue.pop.to_h.to_yaml, :content_type => 'text/plain' end end end ::RubyProf.measure_mode = ::RubyProf::WALL_TIME end |
Instance Method Details
#call(env) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/plaid-rails.rb', line 47 def call(env) return @app.call(env) if env["QUERY_STRING"] =~ /plaid=off/ ::RubyProf.start begin @app.call(env) ensure @queue << ::RubyProf.stop end end |