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
-
#filename_for(string) ⇒ String
Converts a given string into a string that follow Ruby conventions for file names.
-
#module_name_for(string) ⇒ String
Converts a given string into a valid Ruby module name.
Instance Method Details
#filename_for(string) ⇒ String
Converts a given string into a string that follow Ruby conventions for file names
20 21 22 |
# File 'lib/gemstrapper/utility/string_helpers.rb', line 20 def filename_for(string) string.gsub('-', '_') end |
#module_name_for(string) ⇒ String
Converts a given string into a valid Ruby module name
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 |