Class: Global::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/global/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Configuration

Returns a new instance of Configuration.



12
13
14
# File 'lib/global/configuration.rb', line 12

def initialize(hash)
  @hash = hash.respond_to?(:with_indifferent_access) ? hash.with_indifferent_access : hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (protected)



18
19
20
# File 'lib/global/configuration.rb', line 18

def method_missing(method, *args, &block)
  key?(method) ? hash[method] : super
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



7
8
9
# File 'lib/global/configuration.rb', line 7

def hash
  @hash
end