Class: Lurker::Sandbox
- Inherits:
-
Object
- Object
- Lurker::Sandbox
- Defined in:
- lib/lurker/sandbox.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Sandbox
constructor
A new instance of Sandbox.
Constructor Details
#initialize(app) ⇒ Sandbox
Returns a new instance of Sandbox.
3 4 5 |
# File 'lib/lurker/sandbox.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/lurker/sandbox.rb', line 7 def call(env) orig_path = env['PATH_INFO'] if orig_path.ends_with?('.js') || orig_path.ends_with?('css') || orig_path.ends_with?('css.map') @result = @app.call(env) else ActiveRecord::Base.transaction do @result = @app.call(env) raise ActiveRecord::Rollback if called_from_lurker?(env) end end @result end |