Class: Settings::Config

Inherits:
Object
  • Object
show all
Includes:
Provider
Defined in:
lib/configurates.rb

Defined Under Namespace

Classes: NoBlockGiven

Instance Attribute Summary collapse

Class Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(msg, *args, &blk) ⇒ Object (private)

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



77
78
79
# File 'lib/configurates.rb', line 77

def method_missing(msg, *args, &blk)
  message_for_root?(msg) ? @root.send(msg, *args, &blk) : super
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



50
51
52
# File 'lib/configurates.rb', line 50

def root
  @root
end

Class Method Details

.create(&callback) ⇒ Object

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.

Raises:



59
60
61
62
63
# File 'lib/configurates.rb', line 59

def self.create(&callback)
  msg = 'Provider not being chosen'
  raise NoBlockGiven, msg unless block_given?
  new(&callback)
end