HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //usr/lib/ruby/site_ruby/1.8/puppet/util/constant_inflector.rb
# Created on 2008-02-12
# Copyright Luke Kanies

# NOTE: I think it might be worth considering moving these methods directly into Puppet::Util.

# A common module for converting between constants and
# file names.


module Puppet
  module Util
    module ConstantInflector
      def file2constant(file)
        file.split("/").collect { |name| name.capitalize }.join("::").gsub(/_+(.)/) { |term| $1.capitalize }
      end
      module_function :file2constant

      def constant2file(constant)
        constant.to_s.gsub(/([a-z])([A-Z])/) { |term| $1 + "_#{$2}" }.gsub("::", "/").downcase
      end
      module_function :constant2file
    end
  end
end