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


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

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

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args


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

def args
  @args
end

#jobObject (readonly)

Returns the value of attribute job


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

def job
  @job
end

Class Method Details

.abbreviationObject

Dragonfly::Job::Fetch -> 'f'


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

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

.basenameObject

Dragonfly::Job::Fetch -> 'Fetch'


31
32
33
# File 'lib/dragonfly/job.rb', line 31

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

.step_nameObject

Dragonfly::Job::Fetch -> :fetch


35
36
37
# File 'lib/dragonfly/job.rb', line 35

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

Instance Method Details

#initObject

To be overridden


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

def init # To be overridden
end

#inspectObject


54
55
56
# File 'lib/dragonfly/job.rb', line 54

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