Class: Zephyrus::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/zephyrus/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define_attribute(attribute_name, options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/zephyrus/configuration.rb', line 18

def self.define_attribute( attribute_name, options = {} )
  
  class_eval(
    "def #{attribute_name}( *arguments ); " +
       "@#{attribute_name} = arguments.first unless arguments.empty?; " +
       "@#{attribute_name} || " +
         ( options[ :default ].nil? ?
            "nil" :
            ( options[ :default ].is_a?( String ) ? 
                "'#{options[ :default ]}'" : 
                  "#{options[ :default ]}" ) ) + ";" +
    "end",
    __FILE__, 
    __LINE__
  )
end

.reloadable?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/zephyrus/configuration.rb', line 14

def self.reloadable?
  false
end

Instance Method Details

#from_hash(configuration) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/zephyrus/configuration.rb', line 39

def from_hash( configuration )
  
  configuration.each_pair do | name, value |
    self.instance_variable_set( "@#{name}", value )
  end
    
end