Sha256: 88c10c90b3d9e66601ba7211ae46fef2d33272bfde30be133fa9644c4ae80bba

Contents?: true

Size: 522 Bytes

Versions: 7

Compression:

Stored size: 522 Bytes

Contents

class Class
  
  # 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'
  def to_configatron
    name_spaces = self.name.split("::").collect{|s| s.methodize}
    configatron.send_with_chain(name_spaces)
  end
  
end

Version data entries

7 entries across 7 versions & 4 rubygems

Version Path
runcoderun-configatron-2.2.2.1 lib/configatron/core_ext/class.rb
runcoderun-configatron-2.2.2.2 lib/configatron/core_ext/class.rb
sevenwire-configatron-2.2.2 lib/configatron/core_ext/class.rb
configatron-2.2.2 lib/configatron/core_ext/class.rb
configatron-2.3.0 lib/configatron/core_ext/class.rb
mack-0.8.3.1 lib/gems/configatron-2.2.2/lib/configatron/core_ext/class.rb
mack-0.8.3 lib/gems/configatron-2.2.2/lib/configatron/core_ext/class.rb