Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/string_helper.rb
Instance Method Summary collapse
Instance Method Details
#capitalize_first ⇒ Object
5 6 7 8 |
# File 'lib/string_helper.rb', line 5 def capitalize_first self[0, 1].upcase + self[1..-1] self end |
#strip_html(*preserve_tags) ⇒ Object
10 11 12 13 14 |
# File 'lib/string_helper.rb', line 10 def strip_html(*) html = self.strip || '' preserve_array = .join('|') << '|\/' html.gsub(/<(\/|\s)*[^(#{preserve_array})][^>]*>/,'').squeeze(" ").strip end |