Class: Dragonfly::Job::FetchFile

Inherits:
Step show all
Defined in:
lib/dragonfly/job/fetch_file.rb

Instance Attribute Summary

Attributes inherited from Step

#args, #job

Instance Method Summary collapse

Methods inherited from Step

abbreviation, #app, basename, #inspect, step_name, #to_a

Constructor Details

#initialize(job, path) ⇒ FetchFile

Returns a new instance of FetchFile



7
8
9
# File 'lib/dragonfly/job/fetch_file.rb', line 7

def initialize(job, path)
  super(job, path.to_s)
end

Instance Method Details

#applyObject



22
23
24
# File 'lib/dragonfly/job/fetch_file.rb', line 22

def apply
  job.content.update(Pathname.new(path), 'name' => filename)
end

#filenameObject



18
19
20
# File 'lib/dragonfly/job/fetch_file.rb', line 18

def filename
  @filename ||= File.basename(path)
end

#initObject



10
11
12
# File 'lib/dragonfly/job/fetch_file.rb', line 10

def init
  job.url_attributes.name = filename
end

#pathObject



14
15
16
# File 'lib/dragonfly/job/fetch_file.rb', line 14

def path
  @path ||= File.expand_path(args.first)
end