class Sinatra::API::Config
Constants
- Defaults
Attributes
verbose[RW]
with_errors[RW]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/sinatra/api/config.rb, line 11 def initialize(options = {}) api = Sinatra::API options = {}.merge(Config::Defaults).merge(options) options.each_pair do |key, setting| unless self.respond_to?(key) api.logger.warn "Unknown option #{key} => #{setting}" next end self[key] = setting if changed?(key, setting) end super() end
Public Instance Methods
[](key)
click to toggle source
# File lib/sinatra/api/config.rb, line 27 def [](key) self.send key rescue nil end
[]=(key, value)
click to toggle source
# File lib/sinatra/api/config.rb, line 31 def []=(key, value) self.send("#{key}=", value) Sinatra::API.trigger "#{key}_setting", value end
Private Instance Methods
changed?(key, value)
click to toggle source
# File lib/sinatra/api/config.rb, line 38 def changed?(key, value) self[key] != value end