Module: Gemstrapper::Utility::StringHelpers

Included in:
Gemstrapper
Defined in:
lib/gemstrapper/utility/string_helpers.rb

Overview

Mix-in with additional methods for working with Strings

Instance Method Summary collapse

Instance Method Details

#module_name_for(string) ⇒ String

Converts a given string into a valid Ruby module name

Parameters:

  • string (String)

    The string to convert

Returns:

  • (String)

    The given string converted into valid Ruby syntax for constants



12
13
14
# File 'lib/gemstrapper/utility/string_helpers.rb', line 12

def module_name_for(string)
	string.split(/[-,_]/).map {|w| w.capitalize}.join('')
end