Class: RandomShakespeare::Downloader
- Inherits:
-
Object
- Object
- RandomShakespeare::Downloader
- Defined in:
- lib/random_shakespeare/downloader.rb
Constant Summary collapse
- URL =
'http://www.ibiblio.org/xml/examples/shakespeare/macbeth.xml'
- FILENAME =
'lib/random_shakespeare/data/macbeth.xml'
Instance Method Summary collapse
- #file ⇒ Object
-
#initialize(filename = nil) ⇒ Downloader
constructor
A new instance of Downloader.
Constructor Details
#initialize(filename = nil) ⇒ Downloader
Returns a new instance of Downloader.
8 9 10 |
# File 'lib/random_shakespeare/downloader.rb', line 8 def initialize(filename = nil) @filename = filename || FILENAME end |
Instance Method Details
#file ⇒ Object
12 13 14 15 |
# File 'lib/random_shakespeare/downloader.rb', line 12 def file download unless File.exist? @filename open_file end |