Class: Skyscraper::Resource
- Inherits:
-
Object
- Object
- Skyscraper::Resource
- Defined in:
- lib/skyscraper/resource.rb
Instance Method Summary collapse
- #download(options = {}) ⇒ Object
-
#initialize(node) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(node) ⇒ Resource
Returns a new instance of Resource.
3 4 5 6 |
# File 'lib/skyscraper/resource.rb', line 3 def initialize node @node = node @path = extract_path_from_node(@node) end |
Instance Method Details
#download(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/skyscraper/resource.rb', line 8 def download = {} name = [:file_name] || @path.file_name new_file_path = replace_path_variables([:path] || Skyscraper.config.download_path, name) temp_file = open(@path.full_path) copy temp_file.path, new_file_path new_file_path end |