Module: JSSRubyExtensions::String::BackPorts
- Included in:
- String
- Defined in:
- lib/jss/ruby_extensions/string/backports.rb
Constant Summary collapse
- BLANK =
''.freeze
Instance Method Summary collapse
- #casecmp?(other) ⇒ Boolean
- #delete_prefix(pfx) ⇒ Object
- #delete_prefix!(pfx) ⇒ Object
- #delete_suffix(sfx) ⇒ Object
- #delete_suffix!(sfx) ⇒ Object
Instance Method Details
#casecmp?(other) ⇒ Boolean
56 57 58 59 60 |
# File 'lib/jss/ruby_extensions/string/backports.rb', line 56 def casecmp?(other) return nil unless other.is_a? String casecmp(other).zero? end |
#delete_prefix(pfx) ⇒ Object
35 36 37 |
# File 'lib/jss/ruby_extensions/string/backports.rb', line 35 def delete_prefix(pfx) sub /\A#{pfx}/, BLANK end |
#delete_prefix!(pfx) ⇒ Object
39 40 41 |
# File 'lib/jss/ruby_extensions/string/backports.rb', line 39 def delete_prefix!(pfx) sub! /\A#{pfx}/, BLANK end |