Class: Array

Inherits:
Object show all
Defined in:
lib/ruby_ext/array.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.wrap(value) ⇒ Object



10
11
12
# File 'lib/ruby_ext/array.rb', line 10

def self.wrap value
  Array(value)
end

Instance Method Details

#sfilter(*filters) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/ruby_ext/array.rb', line 2

def sfilter *filters
  filters = filters.first if filters.size == 1 and filters.first.is_a?(Array)
  filters.collect!{|o| o.is_a?(Regexp) ? o : /#{Regexp.escape o}/}
  self.select do |line|
    !filters.any?{|re| line =~ re}
  end
end