Module: Bwkfanboy::Fetch

Extended by:
Fetch
Included in:
Fetch
Defined in:
lib/bwkfanboy/fetch.rb

Instance Method Summary collapse

Instance Method Details

#closeStreams(streams) ⇒ Object



28
29
30
31
32
# File 'lib/bwkfanboy/fetch.rb', line 28

def closeStreams streams
  streams.each {|i| i.close }
rescue 
  # do nothing
end

#openStreams(uri) ⇒ Object

Return an array of opened streams.

uri

an array of URIs

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bwkfanboy/fetch.rb', line 14

def openStreams uri
  return nil unless uri

  streams = []
  begin
    uri.each {|i| streams << open(i) }
  rescue
    raise FetchException, "streams: #{$!}"
  end
  
  raise FetchException, 'streams: failed to open at least 1' if streams.size == 0
  streams
end