Module: Sinatra
- Defined in:
- lib/sinatra/base.rb,
lib/sinatra/main.rb,
lib/sinatra/test.rb,
lib/sinatra/compat.rb,
lib/sinatra/showexceptions.rb
Defined Under Namespace
Modules: Compat, Delegator, Helpers, Templates, Test Classes: Application, Base, Default, NotFound, Request, Response, ServerError, ShowExceptions, TestHarness
Constant Summary collapse
- VERSION =
'0.9.2'
Class Method Summary collapse
-
.application ⇒ Object
Deprecated.
-
.application=(value) ⇒ Object
Deprecated.
- .build_application ⇒ Object
-
.const_missing(const_name) ⇒ Object
Make Sinatra::EventContext an alias for Sinatra::Default to unbreak plugins.
- .env ⇒ Object
-
.helpers(*extensions, &block) ⇒ Object
Include the helper modules provided in Sinatra’s request context.
- .host ⇒ Object
-
.new(base = Base, options = {}, &block) ⇒ Object
Create a new Sinatra application.
- .options ⇒ Object
- .port ⇒ Object
-
.register(*extensions, &block) ⇒ Object
Extend the top-level DSL with the modules provided.
Class Method Details
.application ⇒ Object
Deprecated. Use: Sinatra::Application
226 227 228 229 |
# File 'lib/sinatra/compat.rb', line 226 def application sinatra_warn "Sinatra.application is deprecated; use Sinatra::Application instead." Sinatra::Application end |
.application=(value) ⇒ Object
Deprecated. Use: Sinatra::Application.reset!
232 233 234 235 236 237 238 239 |
# File 'lib/sinatra/compat.rb', line 232 def application=(value) raise ArgumentError unless value.nil? sinatra_warn "Setting Sinatra.application to nil is deprecated; create a new instance instead." Sinatra.class_eval do remove_const :Application const_set :Application, Class.new(Sinatra::Default) end end |
.build_application ⇒ Object
241 242 243 244 |
# File 'lib/sinatra/compat.rb', line 241 def build_application sinatra_warn "Sinatra.build_application is deprecated; use Sinatra::Application instead." Sinatra::Application end |
.const_missing(const_name) ⇒ Object
Make Sinatra::EventContext an alias for Sinatra::Default to unbreak plugins.
57 58 59 60 61 62 63 64 65 |
# File 'lib/sinatra/compat.rb', line 57 def self.const_missing(const_name) #:nodoc: if const_name == :EventContext const_set :EventContext, Sinatra::Default sinatra_warn 'Sinatra::EventContext is deprecated; use Sinatra::Default instead.' Sinatra::Default else super end end |
.env ⇒ Object
261 262 263 264 |
# File 'lib/sinatra/compat.rb', line 261 def env sinatra_warn "Sinatra.env is deprecated; use Sinatra::Application.environment instead." .environment end |
.helpers(*extensions, &block) ⇒ Object
Include the helper modules provided in Sinatra’s request context.
1105 1106 1107 |
# File 'lib/sinatra/base.rb', line 1105 def self.helpers(*extensions, &block) Default.helpers(*extensions, &block) end |
.host ⇒ Object
256 257 258 259 |
# File 'lib/sinatra/compat.rb', line 256 def host sinatra_warn "Sinatra.host is deprecated; use Sinatra::Application.host instead." .host end |
.new(base = Base, options = {}, &block) ⇒ Object
Create a new Sinatra application. The block is evaluated in the new app’s class scope.
1093 1094 1095 1096 1097 |
# File 'lib/sinatra/base.rb', line 1093 def self.new(base=Base, ={}, &block) base = Class.new(base) base.send :class_eval, &block if block_given? base end |
.options ⇒ Object
246 247 248 249 |
# File 'lib/sinatra/compat.rb', line 246 def sinatra_warn "Sinatra.options is deprecated; use Sinatra::Application.option_name instead." Sinatra::Application. end |
.port ⇒ Object
251 252 253 254 |
# File 'lib/sinatra/compat.rb', line 251 def port sinatra_warn "Sinatra.port is deprecated; use Sinatra::Application.port instead." .port end |