1
0
Fork 0
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:
Chris Wanstrath 2009-10-11 13:36:39 -07:00 committed by Ryan Tomayko
parent edcf07ee05
commit df210273d4
2 changed files with 7 additions and 2 deletions

View file

@ -390,10 +390,11 @@ module Sinatra
[status, header, body]
end
# Access options defined with Base.set.
def options
# Access settings defined with Base.set.
def settings
self.class
end
alias_method :options, :settings
# Exit the current block, halts any further processing
# of the request, and returns the specified response.

View file

@ -101,6 +101,10 @@ class OptionsTest < Test::Unit::TestCase
assert_equal 'okay', body
end
it 'is accessible from instances via #settings' do
assert_equal :development, @base.new.settings.environment
end
describe 'clean_trace' do
def clean_backtrace(trace)
Sinatra::Base.new.send(:clean_backtrace, trace)