chef
https://github.com/opscode/chef
Ruby
A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
Chef::Mixin::ConvertToClassName#constantize
Tries to find a constant with the name specified in the argument string.
'Module'.constantize # => Module
'Test::Unit'.constantize # => Test::Unit
The name is assumed to be the one of a top-level constant, no matter
whether it starts with "::" or not. No lexical context is taken into
account:
C = 'outside'
module M
C = 'inside'
C # => 'inside'
'C'.constantize # => 'outside', same as ::C
end
NameError is raised when the name is not in CamelCase or the constant is
unknown.Edit
git clone [email protected]:opscode/chef.git
cd chef
open lib/chef/mixin/convert_to_class_name.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Chef--Mixin--ConvertToClassName-constantize-for-pr
# Commit to gitgit add lib/chef/mixin/convert_to_class_name.rbgit commit -m "better docs for Chef::Mixin::ConvertToClassName#constantize"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Chef--Mixin--ConvertToClassName-constantize-for-pr
hub pull-request
# Celebrate!