Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/rexchange.rb
Instance Method Summary collapse
Instance Method Details
#ends_with?(partial) ⇒ Boolean
4 5 6 |
# File 'lib/rexchange.rb', line 4 def ends_with?(partial) self[self.size - partial.size..self.size] == partial end |
#ensure_ends_with(partial) ⇒ Object
8 9 10 |
# File 'lib/rexchange.rb', line 8 def ensure_ends_with(partial) self.ends_with?(partial) ? self : self + partial end |
#normalize ⇒ Object
12 13 14 |
# File 'lib/rexchange.rb', line 12 def normalize self.split(/(?=[A-Z][a-z]*)/).join('_').tr('- ', '_').squeeze('_').downcase end |