Sha256: 7a89c19c6eadaa7e46940789fdc025f3bae050f04ca08120ea65176e37bf0b46
Contents?: true
Size: 493 Bytes
Versions: 63
Compression:
Stored size: 493 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) # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] x = 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
63 entries across 63 versions & 4 rubygems