Class: LcpRuby::Dsl::DslLoader::JobEvalContext

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

Overview

Isolated evaluation context for job DSL files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJobEvalContext

Returns a new instance of JobEvalContext.



337
338
339
# File 'lib/lcp_ruby/dsl/dsl_loader.rb', line 337

def initialize
  @job_definitions = []
end

Instance Attribute Details

#job_definitionsObject (readonly)

Returns the value of attribute job_definitions.



335
336
337
# File 'lib/lcp_ruby/dsl/dsl_loader.rb', line 335

def job_definitions
  @job_definitions
end

Instance Method Details

#define_job(name, &block) ⇒ Object



341
342
343
344
345
346
# File 'lib/lcp_ruby/dsl/dsl_loader.rb', line 341

def define_job(name, &block)
  builder = JobBuilder.new(name)
  builder.instance_eval(&block)
  hash = builder.to_hash
  @job_definitions << BackgroundJobs::Definition.from_hash(hash)
end