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