Class: Dragonfly::Job::FetchUrl
- Inherits:
-
Step
show all
- Defined in:
- lib/dragonfly/job.rb
Instance Attribute Summary
Attributes inherited from Step
#args, #job
Instance Method Summary
(collapse)
Methods inherited from Step
abbreviation, basename, #initialize, #inspect, step_name, #to_a
Instance Method Details
149
150
151
152
153
|
# File 'lib/dragonfly/job.rb', line 149
def apply
open(url) do |f|
job.update(f.read, :name => filename)
end
end
|
- (Object) filename
146
147
148
|
# File 'lib/dragonfly/job.rb', line 146
def filename
@filename ||= File.basename(path) if path[/[^\/]$/]
end
|
137
138
139
|
# File 'lib/dragonfly/job.rb', line 137
def init
job.url_attrs[:name] = filename
end
|
143
144
145
|
# File 'lib/dragonfly/job.rb', line 143
def path
@path ||= URI.parse(url).path
end
|
140
141
142
|
# File 'lib/dragonfly/job.rb', line 140
def url
@url ||= URI.escape((args.first[%r<^\w+://>] ? args.first : "http://#{args.first}"))
end
|