module Gemstrapper::Utility::StringHelpers
Mix-in with additional methods for working with Strings
Public Instance Methods
filename_for(string)
click to toggle source
Converts a given string into a string that follow Ruby conventions for file names @param [String] string the string to convert @return [String] The given string converted into a file name
# File lib/gemstrapper/utility/string_helpers.rb, line 20 def filename_for(string) string.gsub('-', '_') end
module_name_for(string)
click to toggle source
Converts a given string into a valid Ruby module name @param [String] string The string to convert @return [String] The given string converted into valid Ruby syntax for constants
# File lib/gemstrapper/utility/string_helpers.rb, line 12 def module_name_for(string) string.split(/[-,_]/).map {|w| w.capitalize}.join('') end