Class: Pryx::PryHackForRodaRailsMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/pryx/pry_hack.rb

Overview

Hack for roda/rails, 在每一次发送请求之前,总是设定 ENV to nil. 这可以确保,pry! 总是会被拦截,但是仅仅只会被拦截一次。

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ PryHackForRodaRailsMiddleware

Returns a new instance of PryHackForRodaRailsMiddleware.



87
88
89
# File 'lib/pryx/pry_hack.rb', line 87

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



85
86
87
# File 'lib/pryx/pry_hack.rb', line 85

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



91
92
93
94
# File 'lib/pryx/pry_hack.rb', line 91

def call(env)
  ENV['Pry_was_started'] = nil
  @app.call(env)
end