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

- (Step) initialize(job, *args)

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

- (Object) args (readonly)

Returns the value of attribute args



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

def args
  @args
end

- (Object) job (readonly)

Returns the value of attribute job



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

def job
  @job
end

Class Method Details

+ (Object) abbreviation

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



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

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

+ (Object) basename

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



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

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

+ (Object) step_name

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

- (Object) init

To be overridden



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

def init 
end

- (Object) inspect



58
59
60
# File 'lib/dragonfly/job.rb', line 58

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

- (Object) to_a



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

def to_a
  [self.class.abbreviation, *args]
end