1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

add environment predicates

This commit is contained in:
Ryan Tomayko 2008-08-31 02:34:40 -07:00
parent 1add9fc9f6
commit 7b59fe76d6

View file

@ -862,6 +862,7 @@ module Sinatra
FORWARD_METHODS = %w[
get put post delete head template layout before error not_found
configures configure set set_options set_option enable disable use
development? test? production?
]
# Create a new Application with a default configuration taken
@ -1102,9 +1103,14 @@ module Sinatra
filter :before, &b
end
def development?
options.env == :development
end
# True when environment is :development.
def development? ; options.env == :development ; end
# True when environment is :test.
def test? ; options.env == :test ; end
# True when environment is :production.
def production? ; options.env == :production ; end
# Clear all events, templates, filters, and error handlers
# and then reload the application source file. This occurs