Class: ConfigFu::Configuration

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

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



30
31
32
33
34
35
# File 'lib/config_fu.rb', line 30

def method_missing(meth, *args)
  if meth.to_s =~ /\w+=/
    self.class.send(:attr_accessor, meth.to_s.gsub(/=/, ''))
    send(meth, *args)
  end
end

Class Method Details

.configure(env = Rails.env.to_sym) {|instance| ... } ⇒ Object

Yields:

  • (instance)


22
23
24
25
26
27
28
# File 'lib/config_fu.rb', line 22

def self.configure(env = Rails.env.to_sym)
  env = [env].flatten
  return unless env.include?(Rails.env.to_sym)

  yield instance if block_given?
  ConfigFu.config = instance
end