diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 56a07b1f..2bb1dab1 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -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. diff --git a/test/options_test.rb b/test/options_test.rb index 19f5ea2d..8b046ca7 100644 --- a/test/options_test.rb +++ b/test/options_test.rb @@ -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)