Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ext/string.rb
Instance Method Summary collapse
- #camelize(first_letter_in_uppercase = true) ⇒ Object
- #constantize ⇒ Object
- #dasherize ⇒ Object
- #demodulize ⇒ Object
- #foreign_key(separate_class_name_and_id_with_underscore = true) ⇒ Object
- #ordinalize ⇒ Object
- #underscore ⇒ Object
- #wrap(col = 80) ⇒ Object
Instance Method Details
#camelize(first_letter_in_uppercase = true) ⇒ Object
77 78 79 |
# File 'lib/ext/string.rb', line 77 def camelize(first_letter_in_uppercase = true) Inflector.camelize(self, first_letter_in_uppercase) end |
#constantize ⇒ Object
73 74 75 |
# File 'lib/ext/string.rb', line 73 def constantize Inflector.constantize(self) end |
#dasherize ⇒ Object
85 86 87 |
# File 'lib/ext/string.rb', line 85 def dasherize Inflector.dasherize(self) end |
#demodulize ⇒ Object
89 90 91 |
# File 'lib/ext/string.rb', line 89 def demodulize Inflector.demodulize(self) end |
#foreign_key(separate_class_name_and_id_with_underscore = true) ⇒ Object
93 94 95 |
# File 'lib/ext/string.rb', line 93 def foreign_key(separate_class_name_and_id_with_underscore = true) Inflector.foreign_key(self, separate_class_name_and_id_with_underscore) end |
#ordinalize ⇒ Object
97 98 99 |
# File 'lib/ext/string.rb', line 97 def ordinalize Inflector.ordinalize(self) end |
#underscore ⇒ Object
81 82 83 |
# File 'lib/ext/string.rb', line 81 def underscore Inflector.underscore(self) end |
#wrap(col = 80) ⇒ Object
101 102 103 104 |
# File 'lib/ext/string.rb', line 101 def wrap(col=80) # http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/ gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/, "\\1\\3\n") end |