Class: Class

Inherits:
Object show all
Defined in:
lib/gems/configatron-2.2.2/lib/configatron/core_ext/class.rb

Instance Method Summary collapse

Instance Method Details

#to_configatronObject

Returns access to configuration parameters named after the class.

Examples:

configatron.foo.bar = :bar
configatron.a.b.c.d = 'D'

class Foo
end

module A
  module B
    class C
    end
  end
end

Foo.to_configatron.bar # => :bar
A::B::C.to_configatron.d # => 'D'


21
22
23
24
# File 'lib/gems/configatron-2.2.2/lib/configatron/core_ext/class.rb', line 21

def to_configatron
  name_spaces = self.name.split("::").collect{|s| s.methodize}
  configatron.send_with_chain(name_spaces)
end