Class: Rubydoop::ConfigurationDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/rubydoop/dsl.rb

Overview

Lower level API for configuring jobs.

Examples:

Configuring a job


cc = ConfigurationDefinition.new
cc.job 'word_count' do
  # same DSL as shown in the documentation for Rubydoop.configure
end

Instance Method Summary collapse

Constructor Details

#initialize(context = $rubydoop_context, &block) ⇒ ConfigurationDefinition

Returns a new instance of ConfigurationDefinition.



50
51
52
53
# File 'lib/rubydoop/dsl.rb', line 50

def initialize(context=$rubydoop_context, &block)
  @context = context
  instance_exec(*arguments, &block) if @context && block_given?
end

Instance Method Details

#argumentsObject



55
56
57
# File 'lib/rubydoop/dsl.rb', line 55

def arguments
  @context.arguments
end

#job(name, &block) ⇒ Object



59
60
61
62
63
64
# File 'lib/rubydoop/dsl.rb', line 59

def job(name, &block)
  return nil unless @context
  job = JobDefinition.new(@context, @context.create_job(name))
  job.instance_exec(&block)
  job
end

#parallel(&block) ⇒ Object



66
67
68
# File 'lib/rubydoop/dsl.rb', line 66

def parallel(&block)
  @context.parallel(&block)
end

#sequence(&block) ⇒ Object



70
71
72
# File 'lib/rubydoop/dsl.rb', line 70

def sequence(&block)
  @context.sequence(&block)
end