Sha256: b44185684ac648b8b61648518e1a63ca0737720aa46bd3c08c06b90d804737ad

Contents?: true

Size: 716 Bytes

Versions: 76

Compression:

Stored size: 716 Bytes

Contents

module Dragonfly
  class JobBuilder

    def initialize(&block)
      @block = block
    end

    def build(job, *args)
      evaluate_block(job, false, *args)
    end

    def build!(job, *args)
      evaluate_block(job, true, *args)
    end

    Job.step_names.each do |step|
      
      # fetch, process, etc.
      define_method step do |*args|
        if @perform_with_bangs
          @job.send("#{step}!", *args)
        else
          @job = @job.send(step, *args)
        end
      end
      
    end
    
    private
    
    def evaluate_block(job, perform_with_bangs, *args)
      @job = job
      @perform_with_bangs = perform_with_bangs
      instance_exec(*args, &@block)
      @job
    end

  end
end

Version data entries

76 entries across 76 versions & 4 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.7.4 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.7.3 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.7.2 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.7.1 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.7.0 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
dragonfly-0.9.15 lib/dragonfly/job_builder.rb
dragonfly-0.8.6 lib/dragonfly/job_builder.rb
dragonfly-0.9.14 lib/dragonfly/job_builder.rb
dragonfly-0.9.13 lib/dragonfly/job_builder.rb
classiccms-0.6.9 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.8 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.7 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.6 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.5 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.4 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.3 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.2 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.1 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb
classiccms-0.6.0 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/job_builder.rb