Module: ImageSearcher::Filter
- Included in:
- ImageSearcher
- Defined in:
- lib/image_searcher/filter.rb
Instance Method Summary collapse
Instance Method Details
#filter_by_format(result, format) ⇒ Object
3 4 5 |
# File 'lib/image_searcher/filter.rb', line 3 def filter_by_format(result, format) result.keep_if { |h| h["url"].match(/.#{format}/i) } end |
#filter_by_formats(result, formats) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/image_searcher/filter.rb', line 7 def filter_by_formats(result, formats) formats.each do |f| result = result.keep_if { |h| h['url'].match(/.#{f}/i) } end result end |