class SkylabStudio::Config
Constants
- DEFAULT_URL
Attributes
settings[RW]
Public Class Methods
defaults()
click to toggle source
# File lib/skylab_studio/config.rb, line 9 def self.defaults source = URI.parse(DEFAULT_URL) { url: DEFAULT_URL, api_key: nil, protocol: source.scheme, host: source.host, port: source.port, api_version: 'v1', debug: true, client_stub: "ruby-#{VERSION}" } end
new(options = {})
click to toggle source
# File lib/skylab_studio/config.rb, line 24 def initialize(options = {}) @settings = SkylabStudio::Config.defaults.merge(options) end
Public Instance Methods
method_missing(meth, *args, &block)
click to toggle source
Calls superclass method
# File lib/skylab_studio/config.rb, line 28 def method_missing(meth, *args, &block) meth_str = meth.to_s if meth_str.include?('=') # If this is a write attempt, see if we can write to that key meth_sym = meth_str.delete('=').to_sym has?(meth_sym) ? @settings[meth_sym] = args[0] : super else # It's a read attempt, see if that key exists has?(meth) ? @settings[meth] : super end end
respond_to_missing?(meth, include_private = false)
click to toggle source
Calls superclass method
# File lib/skylab_studio/config.rb, line 42 def respond_to_missing?(meth, include_private = false) has?(meth) || super end
Private Instance Methods
has?(key)
click to toggle source
# File lib/skylab_studio/config.rb, line 48 def has?(key) @settings.key?(key) end