Class: Rack::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/base.rb

Instance Method Summary collapse

Instance Method Details

#Sinatra(file, base = Sinatra::Default) ⇒ Object

Sugar to include a classic style app in a rackup.

This will eval the source into a Sinatra::Default class Example:

require ‘sinatra/base’

map ‘/foo’ do

run Sinatra("foo.rb")

end

run Sinatra(“bar.rb”)



998
999
1000
1001
1002
1003
1004
# File 'lib/sinatra/base.rb', line 998

def Sinatra(file, base=Sinatra::Default)
  Sinatra.new(base) do
    expanded = File.expand_path(file)
    self.class_eval { set :app_file, expanded }
    self.class_eval(File.read(expanded), expanded)
  end
end