Class: DotHash::Settings

Inherits:
Properties show all
Defined in:
lib/dot_hash/settings.rb

Class Attribute Summary collapse

Attributes inherited from Properties

#hash

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Properties

#[], #method_missing, #respond_to_missing?, #to_json, #to_s

Constructor Details

#initialize(*args) ⇒ Settings

Returns a new instance of Settings.



3
4
5
# File 'lib/dot_hash/settings.rb', line 3

def initialize(*args)
  super Loader.new(*args).load
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DotHash::Properties

Class Attribute Details

.instanceObject (readonly)

Returns the value of attribute instance.



8
9
10
# File 'lib/dot_hash/settings.rb', line 8

def instance
  @instance
end

Class Method Details

.load(*args) ⇒ Object



18
19
20
# File 'lib/dot_hash/settings.rb', line 18

def load(*args)
  @instance = new(*args)
end

.method_missing(*args, &block) ⇒ Object



10
11
12
# File 'lib/dot_hash/settings.rb', line 10

def method_missing(*args, &block)
  instance.public_send(*args, &block)
end

.namespace(namespace) ⇒ Object



22
23
24
# File 'lib/dot_hash/settings.rb', line 22

def namespace(namespace)
  @instance = @instance[namespace]
end

.respond_to_missing?(*args) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/dot_hash/settings.rb', line 14

def respond_to_missing?(*args)
  instance.respond_to?(*args)
end