Class: Merb::Rack::Runner

Inherits:
Object show all
Defined in:
lib/merb-core/rack/adapter/runner.rb

Class Method Summary collapse

Class Method Details

.start(opts = {}) ⇒ Object

Parameters

opts<Hash>

Options for the runner (see below).

Options (opts)

:runner_code<String>

The code to run.

Notes

If opts matches a filename, that file will be read and the contents executed. Otherwise the code will be executed directly.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/merb-core/rack/adapter/runner.rb', line 15

def self.start(opts={})
  Merb::Server.change_privilege
  if opts[:runner_code]
    if File.exists?(opts[:runner_code])
      eval(File.read(opts[:runner_code]), TOPLEVEL_BINDING, __FILE__, __LINE__)
    else
      eval(opts[:runner_code], TOPLEVEL_BINDING, __FILE__, __LINE__)
    end
    exit
  end  
end