class Settings::Config

Attributes

root[R]

Public Class Methods

create(&callback) click to toggle source

Currently provider(s) can be registered only when we creating new instance based on Settings:Config class. It means self.create should be a higher function.

# File lib/configurates.rb, line 59
def self.create(&callback)
  msg = 'Provider not being chosen'
  raise NoBlockGiven, msg unless block_given?
  new(&callback)
end
new(&callback) click to toggle source

Run &callback code in object instance.

# File lib/configurates.rb, line 70
def initialize(&callback)
  instance_eval(&callback)
end

Private Instance Methods

message_for_root?(msg) click to toggle source
# File lib/configurates.rb, line 91
def message_for_root?(msg)
  @root.send(:respond_to?, msg) ? true : false
end
method_missing(msg, *args, &blk) click to toggle source

Provide message redirect in the @root (storage) if it's possible.

Calls superclass method
# File lib/configurates.rb, line 77
def method_missing(msg, *args, &blk)
  message_for_root?(msg) ? @root.send(msg, *args, &blk) : super
end
respond_to?(msg, include_private = false) click to toggle source

And extend respond_to with storate's responses

Calls superclass method
# File lib/configurates.rb, line 84
def respond_to?(msg, include_private = false)
  super || message_for_root?(msg) ? true : false
end