Class: Dragonfly::Job::Step

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

Direct Known Subclasses

Encode, Fetch, FetchFile, Generate, Process

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Step

Returns a new instance of Step.



38
39
40
# File 'lib/dragonfly/job.rb', line 38

def initialize(*args)
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args



42
43
44
# File 'lib/dragonfly/job.rb', line 42

def args
  @args
end

Class Method Details

.abbreviationObject

Dragonfly::Job::Fetch -> :f



33
34
35
# File 'lib/dragonfly/job.rb', line 33

def abbreviation
  @abbreviation ||= basename.scan(/[A-Z]/).join.downcase.to_sym
end

.basenameObject

Dragonfly::Job::Fetch -> ‘Fetch’



25
26
27
# File 'lib/dragonfly/job.rb', line 25

def basename
  @basename ||= name.split('::').last
end

.step_nameObject

Dragonfly::Job::Fetch -> :fetch



29
30
31
# File 'lib/dragonfly/job.rb', line 29

def step_name
  @step_name ||= basename.gsub(/[A-Z]/){ "_#{$&.downcase}" }.sub('_','').to_sym
end

Instance Method Details

#inspectObject



50
51
52
# File 'lib/dragonfly/job.rb', line 50

def inspect
  "#{self.class.step_name}(#{args.map{|a| a.inspect }.join(', ')})"
end

#update_temp_object(job, content, extra) ⇒ Object



44
45
46
47
48
# File 'lib/dragonfly/job.rb', line 44

def update_temp_object(job, content, extra)
  temp_object = TempObject.new(content, job.temp_object.attributes)
  temp_object.extract_attributes_from(extra) if extra
  job.temp_object = temp_object
end