mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Adds a #settings method which #options is alised to.
I propose options be renamed "settings" - the nomenclature is perhaps more appropriate. set & settings vs set & options
This commit is contained in:
parent
edcf07ee05
commit
df210273d4
2 changed files with 7 additions and 2 deletions
|
@ -390,10 +390,11 @@ module Sinatra
|
||||||
[status, header, body]
|
[status, header, body]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Access options defined with Base.set.
|
# Access settings defined with Base.set.
|
||||||
def options
|
def settings
|
||||||
self.class
|
self.class
|
||||||
end
|
end
|
||||||
|
alias_method :options, :settings
|
||||||
|
|
||||||
# Exit the current block, halts any further processing
|
# Exit the current block, halts any further processing
|
||||||
# of the request, and returns the specified response.
|
# of the request, and returns the specified response.
|
||||||
|
|
|
@ -101,6 +101,10 @@ class OptionsTest < Test::Unit::TestCase
|
||||||
assert_equal 'okay', body
|
assert_equal 'okay', body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'is accessible from instances via #settings' do
|
||||||
|
assert_equal :development, @base.new.settings.environment
|
||||||
|
end
|
||||||
|
|
||||||
describe 'clean_trace' do
|
describe 'clean_trace' do
|
||||||
def clean_backtrace(trace)
|
def clean_backtrace(trace)
|
||||||
Sinatra::Base.new.send(:clean_backtrace, trace)
|
Sinatra::Base.new.send(:clean_backtrace, trace)
|
||||||
|
|
Loading…
Reference in a new issue