PageRenderTime 257ms CodeModel.GetById 253ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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