Method: Microformat::Collection#filter
- Defined in:
- lib/microformat/collection.rb
#filter(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/microformat/collection.rb', line 14 def filter(*args) classes = Array(args).flatten # find the applicable classes filtered = select do |object| Array(classes).include?(object.class) end # create a new collection from them self.class.new.tap do |collection| collection.replace(filtered) end end |