# File lib/chef/mixin/convert_to_class_name.rb, line 25 def convert_to_class_name(str) str = str.dup str.gsub!(/[^A-Za-z0-9_]/,'_') rname = nil regexp = %{^(.+?)(_(.+))?$} mn = str.match(regexp) if mn rname = mn[1].capitalize while mn && mn[3] mn = mn[3].match(regexp) rname << mn[1].capitalize if mn end end rname end
# File lib/chef/mixin/convert_to_class_name.rb, line 44 def convert_to_snake_case(str, namespace=nil) str = str.dup str.sub!(/^#{namespace}(\:\:)?/, '') if namespace str.gsub!(/[A-Z]/) {|s| "_" + s} str.downcase! str.sub!(/^\_/, "") str end
Generated with the Darkfish Rdoc Generator 2.