Add class level #settings for convenience.
This commit is contained in:
parent
bade15e7bc
commit
33affbf264
|
@ -446,10 +446,19 @@ module Sinatra
|
|||
end
|
||||
|
||||
# Access settings defined with Base.set.
|
||||
def settings
|
||||
self.class
|
||||
def self.settings
|
||||
self
|
||||
end
|
||||
|
||||
# Access settings defined with Base.set.
|
||||
def settings
|
||||
self.class.settings
|
||||
end
|
||||
|
||||
alias_method :options, :settings
|
||||
class << self
|
||||
alias_method :options, :settings
|
||||
end
|
||||
|
||||
# Exit the current block, halts any further processing
|
||||
# of the request, and returns the specified response.
|
||||
|
|
|
@ -115,6 +115,10 @@ class SettingsTest < Test::Unit::TestCase
|
|||
assert_equal :foo, @base.new.settings.environment
|
||||
end
|
||||
|
||||
it 'is accessible from class via #settings' do
|
||||
assert_equal :foo, @base.settings.environment
|
||||
end
|
||||
|
||||
describe 'methodoverride' do
|
||||
it 'is disabled on Base' do
|
||||
assert ! @base.method_override?
|
||||
|
|
Loading…
Reference in New Issue