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

Constructor Details

This class inherits a constructor from Dragonfly::Job::Step

Instance Method Details

#applyObject



129
130
131
132
133
# File 'lib/dragonfly/job.rb', line 129

def apply
  open(url) do |f|
    job.temp_object = TempObject.new(f.read)
  end
end

#initObject



120
121
122
# File 'lib/dragonfly/job.rb', line 120

def init
  job.name = File.basename(path) if path[/[^\/]$/]
end

#pathObject



126
127
128
# File 'lib/dragonfly/job.rb', line 126

def path
  @path ||= URI.parse(url).path
end

#urlObject



123
124
125
# File 'lib/dragonfly/job.rb', line 123

def url
  @url ||= (args.first[%r<^\w+://>] ? args.first : "http://#{args.first}")
end