Class: HTML2FB::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/downloader.rb

Class Method Summary collapse

Class Method Details

.download(uri) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/downloader.rb', line 12

def self.download(uri)
  print "Downloading   "
  puts uri.to_s
  #tmp=Tempfile.new(uri.gsub(/[^a-z0-9]/,'_'))
  #tmp.open('w'){|a|
  #  uri.open('r'){|b|
  #    a.write b
  #  }
  #}
  Kernel.open(uri.to_s,'r').read
end

.valid_url?(entry) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/downloader.rb', line 6

def self.valid_url?(entry)
  uri=URI.parse(entry)
  Kernel.open(uri.to_s,'r')
  return uri
end