module Puppet::Util::ConstantInflector

Public Class Methods

constant2file(constant) click to toggle source
# 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) click to toggle source
# File lib/puppet/util/constant_inflector.rb, line 13
def file2constant(file)
  # LAK:NOTE See http://snurl.com/21zf8  [groups_google_com]
  x = file.split("/").collect { |name| name.capitalize }.join("::").gsub(/_+(.)/) { |term| $1.capitalize }
end