Module: Puppet::Util::ConstantInflector
- Defined in:
- lib/puppet/util/constant_inflector.rb
Class Method Summary collapse
Class Method Details
.constant2file(constant) ⇒ Object
19 20 21 |
# File 'lib/puppet/util/constant_inflector.rb', line 19 def constant2file(constant) constant.to_s.gsub(/([a-z])([A-Z])/) { |term| $1 + "_#{$2}" }.gsub("::", "/").downcase end |
.file2constant(file) ⇒ Object
14 15 16 |
# File 'lib/puppet/util/constant_inflector.rb', line 14 def file2constant(file) file.split("/").collect { |name| name.capitalize }.join("::").gsub(/_+(.)/) { |term| $1.capitalize } end |