Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ventouse/filter_prefix.rb

Instance Method Summary collapse

Instance Method Details

#filter_prefix(prefix) ⇒ Object



7
8
9
10
11
# File 'lib/ventouse/filter_prefix.rb', line 7

def filter_prefix prefix
  s = clone
  s.filter_prefix! prefix
  s
end

#filter_prefix!(prefix) ⇒ Object



2
3
4
5
# File 'lib/ventouse/filter_prefix.rb', line 2

def filter_prefix! prefix
  sliced = slice! /^#{prefix}/
  !sliced.nil?
end