Class: Dragonfly::Job::FetchUrl
Instance Attribute Summary
Attributes inherited from Step
#args, #job
Instance Method Summary
collapse
Methods inherited from Step
abbreviation, basename, #initialize, #inspect, step_name
Instance Method Details
142
143
144
145
146
|
# File 'lib/dragonfly/job.rb', line 142
def apply
open(url) do |f|
job.update(f.read, :name => filename)
end
end
|
139
140
141
|
# File 'lib/dragonfly/job.rb', line 139
def filename
@filename ||= File.basename(path) if path[/[^\/]$/]
end
|
130
131
132
|
# File 'lib/dragonfly/job.rb', line 130
def init
job.url_attrs[:name] = filename
end
|
136
137
138
|
# File 'lib/dragonfly/job.rb', line 136
def path
@path ||= URI.parse(url).path
end
|
133
134
135
|
# File 'lib/dragonfly/job.rb', line 133
def url
@url ||= (args.first[%r<^\w+://>] ? args.first : "http://#{args.first}")
end
|