Class: Skyscraper::Resource

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

Instance Method Summary collapse

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 options = {}
  name          = options[:file_name] || @path.file_name
  new_file_path = replace_path_variables(options[:path] || Skyscraper.config.download_path, name)
  temp_file     = open(@path.full_path)

  copy temp_file.path, new_file_path
  new_file_path
end