Class: StringHelper
- Inherits:
-
Object
- Object
- StringHelper
- Defined in:
- lib/string_helper.rb
Class Method Summary collapse
- .constantize(word) ⇒ Object
-
.singularize(word) ⇒ Object
super simple singularizer.
- .to_class(word) ⇒ Object
Class Method Details
.constantize(word) ⇒ Object
14 15 16 |
# File 'lib/string_helper.rb', line 14 def self.constantize(word) word.constantize end |
.singularize(word) ⇒ Object
super simple singularizer
10 11 12 |
# File 'lib/string_helper.rb', line 10 def self.singularize(word) word.gsub /(.*)s/,'\1' end |
.to_class(word) ⇒ Object
5 6 7 |
# File 'lib/string_helper.rb', line 5 def self.to_class(word) singularize(word.to_s).camelize.constantize end |