/tools/Ruby/lib/ruby/gems/1.8/gems/configatron-2.8.2/lib/configatron/core_ext/class.rb

http://github.com/agross/netopenspace · Ruby · 25 lines · 5 code · 2 blank · 18 comment · 0 complexity · 9cfc48720b70bc8d10d481665945ec54 MD5 · raw file

  1. class Class
  2. # Returns access to configuration parameters named after the class.
  3. #
  4. # Examples:
  5. # configatron.foo.bar = :bar
  6. # configatron.a.b.c.d = 'D'
  7. #
  8. # class Foo
  9. # end
  10. #
  11. # module A
  12. # module B
  13. # class C
  14. # end
  15. # end
  16. # end
  17. #
  18. # Foo.to_configatron.bar # => :bar
  19. # A::B::C.to_configatron.d # => 'D'
  20. def to_configatron(*args)
  21. self.name.to_configatron(*args)
  22. end
  23. end