Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ruby_cpu/core_ext/string/trim.rb
Instance Method Summary collapse
Instance Method Details
#trim(char) ⇒ Object
2 3 4 |
# File 'lib/ruby_cpu/core_ext/string/trim.rb', line 2 def trim char self.gsub(/^#{char}|#{char}$/, "") end |
#trim!(char) ⇒ Object
6 7 8 |
# File 'lib/ruby_cpu/core_ext/string/trim.rb', line 6 def trim! char self.gsub!(/^#{char}|#{char}$/, "") end |