Module: Goodyear::Enumerable

Defined in:
lib/goodyear/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#collect(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/goodyear/enumerable.rb', line 13

def collect &block
  fetch.results.collect do |result|
    if block_given? 
      block.call result
    else
      yield result
    end
  end
end

#each(&block) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/goodyear/enumerable.rb', line 3

def each &block
  fetch.results.each do |result|
    if block_given?
      block.call result
    else
      yield result
    end
  end
end