Sha256: e64d387d5d72df8ca94db76daea97fd9ea74f1155d1c2e0fa9fb453dbc5dc1b0
Contents?: true
Size: 442 Bytes
Versions: 2
Compression:
Stored size: 442 Bytes
Contents
# Created on 2008-02-12 # Copyright Luke Kanies # A common module for converting between constants and # file names. module Puppet::Util::ConstantInflector def file2constant(file) file.split("/").collect { |name| name.capitalize }.join("::").gsub(/_+(.)/) { |term| $1.capitalize } end def constant2file(constant) constant.to_s.gsub(/([a-z])([A-Z])/) { |term| $1 + "_" + $2 }.gsub("::", "/").downcase end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-0.24.3 | lib/puppet/util/constant_inflector.rb |
puppet-0.24.2 | lib/puppet/util/constant_inflector.rb |