Module: Minglr::Extensions::Array

Defined in:
lib/minglr/extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#filter(attributes, words) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/minglr/extensions/array.rb', line 7

def filter(attributes, words)
  collection = self
  words.each do |word|
    collection = self.select do |element|
      output = ""
      attributes.each { |attribute| output << element.send(attribute).to_s + " " }
      output =~ /#{word}/i
    end
  end
  collection
end