Class: DotHash::Settings

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

Instance Attribute Summary

Attributes inherited from Properties

#hash

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Properties

#==, #[], #fetch, #has_key?, #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).hash
end

Dynamic Method Handling

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

Class Method Details

.load(*args) ⇒ Object



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

def load(*args)
  instance.load(*args)
end

.method_missing(*args, &block) ⇒ Object



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

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

.respond_to_missing?(*args) ⇒ Boolean

Returns:

  • (Boolean)


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

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

Instance Method Details

#load(*args) ⇒ Object



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

def load(*args)
  @cached = {}
  @hash = Loader.new(hash, *args).hash
end