Class: Infrastructure::Configuration
- Inherits:
- 
      Object
      
        - Object
- Infrastructure::Configuration
 
- Defined in:
- lib/infrastructure/configuration.rb
Overview
infrastructure settings configuration
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(attr = {})  ⇒ Configuration 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Configuration. 
- #properties ⇒ Object
Constructor Details
#initialize(attr = {}) ⇒ Configuration
Returns a new instance of Configuration.
| 23 24 25 26 27 | # File 'lib/infrastructure/configuration.rb', line 23 def initialize(attr = {}) self.class.properties.map do |property, env_var_name| send("#{property}=", attr[property] || ENV[env_var_name]) end end | 
Class Method Details
.properties ⇒ Object
| 7 8 9 | # File 'lib/infrastructure/configuration.rb', line 7 def properties @properties ||= [] end | 
.property(name, env_var_name = nil) ⇒ Object
| 11 12 13 14 | # File 'lib/infrastructure/configuration.rb', line 11 def property(name, env_var_name = nil) attr_accessor name properties << [name, (env_var_name || name.to_s.upcase)] end | 
Instance Method Details
#properties ⇒ Object
| 29 30 31 | # File 'lib/infrastructure/configuration.rb', line 29 def properties self.class.properties.each_with_object({}) { |p, memo| memo[p] = send(p) } end |