Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ventouse/filter_prefix.rb
Instance Method Summary collapse
- #filter_prefix(prefix, ignore_case = false) ⇒ Object
- #filter_prefix!(prefix, ignore_case = false) ⇒ Object
Instance Method Details
#filter_prefix(prefix, ignore_case = false) ⇒ Object
7 8 9 10 11 |
# File 'lib/ventouse/filter_prefix.rb', line 7 def filter_prefix prefix, ignore_case = false s = clone s.filter_prefix! prefix, ignore_case s end |
#filter_prefix!(prefix, ignore_case = false) ⇒ Object
2 3 4 5 |
# File 'lib/ventouse/filter_prefix.rb', line 2 def filter_prefix! prefix, ignore_case = false sliced = ignore_case ? slice!(/^#{prefix}/i) : slice!(/^#{prefix}/) !sliced.nil? end |