Sha256: 0e2e18793d3e340f2b8985b0b8b989657060dfbc1377e42fdee7cb954d5190bb

Contents?: true

Size: 628 Bytes

Versions: 19

Compression:

Stored size: 628 Bytes

Contents

class Hayabusa::Erb_handler
  def initialize
    @connected = {}
  end
  
  def erb_handler(httpsess)
    eruby = httpsess.eruby
    
    if !@connected.key?(eruby.__id__)
      eruby.connect("error", &self.method(:on_error))
      @connected[eruby.__id__] = true
    end
    
    if !File.exists?(httpsess.page_path)
      eruby.import("#{File.dirname(__FILE__)}/../pages/error_notfound.rhtml")
    else
      eruby.import(httpsess.page_path)
    end
    
    httpsess.resp.status = 500 if eruby.error
  end
  
  #Handels the event when an error in the eruby-instance occurs.
  def on_error(e)
    _hb.handle_error(e)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hayabusa-0.0.20 lib/hayabusa_erb_handler.rb
hayabusa-0.0.19 lib/hayabusa_erb_handler.rb
hayabusa-0.0.18 lib/hayabusa_erb_handler.rb
hayabusa-0.0.17 lib/hayabusa_erb_handler.rb
hayabusa-0.0.16 lib/hayabusa_erb_handler.rb
hayabusa-0.0.15 lib/hayabusa_erb_handler.rb
hayabusa-0.0.14 lib/hayabusa_erb_handler.rb
hayabusa-0.0.13 lib/hayabusa_erb_handler.rb
hayabusa-0.0.12 lib/hayabusa_erb_handler.rb
hayabusa-0.0.11 lib/hayabusa_erb_handler.rb
hayabusa-0.0.10 lib/hayabusa_erb_handler.rb
hayabusa-0.0.9 lib/hayabusa_erb_handler.rb
hayabusa-0.0.8 lib/hayabusa_erb_handler.rb
hayabusa-0.0.6 lib/hayabusa_erb_handler.rb
hayabusa-0.0.5 lib/hayabusa_erb_handler.rb
hayabusa-0.0.4 lib/hayabusa_erb_handler.rb
hayabusa-0.0.3 lib/hayabusa_erb_handler.rb
hayabusa-0.0.2 lib/hayabusa_erb_handler.rb
hayabusa-0.0.1 lib/hayabusa_erb_handler.rb