Sha256: da1f73fdda0492c4bcd611ec20d91e521326550caa5e583d8ef1d2779bcc41ac

Contents?: true

Size: 500 Bytes

Versions: 9

Compression:

Stored size: 500 Bytes

Contents

class Array
  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

  def self.wrap value
    Array(value)
  end

  alias_method :blank?, :empty?

  alias_method :filter, :select

  def extract_options
    last.is_a?(Hash) ? last : {}
  end

  def extract_options!
    last.is_a?(Hash) ? pop : {}
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby_ext-0.5.9 lib/ruby_ext/core/array.rb
ruby_ext-0.5.8 lib/ruby_ext/core/array.rb
ruby_ext-0.5.7 lib/ruby_ext/core/array.rb
ruby_ext-0.5.6 lib/ruby_ext/core/array.rb
ruby_ext-0.5.5 lib/ruby_ext/core/array.rb
ruby_ext-0.5.4 lib/ruby_ext/core/array.rb
ruby_ext-0.5.3 lib/ruby_ext/core/array.rb
ruby_ext-0.5.2 lib/ruby_ext/core/array.rb
ruby_ext-0.5.1 lib/ruby_ext/core/array.rb