Class: Dragonfly::Job::Step

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

Direct Known Subclasses

Encode, Fetch, FetchFile, FetchUrl, Generate, Process

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, *args) ⇒ Step

Returns a new instance of Step.



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

def initialize(job, *args)
  @job, @args = job, args
  init
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args



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

def args
  @args
end

#jobObject (readonly)

Returns the value of attribute job



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

def job
  @job
end

Class Method Details

.abbreviationObject

Dragonfly::Job::Fetch -> :f



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

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

.basenameObject

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



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

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

.step_nameObject

Dragonfly::Job::Fetch -> :fetch



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

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

Instance Method Details

#initObject

To be overridden



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

def init 
end

#inspectObject



52
53
54
# File 'lib/dragonfly/job.rb', line 52

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