Class: Metacrunch::Job::Dsl

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

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ Dsl

Returns a new instance of Dsl.



5
6
7
# File 'lib/metacrunch/job/dsl.rb', line 5

def initialize(job)
  @_job = job
end

Instance Method Details

#destination(destination) ⇒ Object



13
14
15
# File 'lib/metacrunch/job/dsl.rb', line 13

def destination(destination)
  @_job.destination = destination
end

#options(require_args: false, &block) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/metacrunch/job/dsl.rb', line 29

def options(require_args: false, &block)
  if block_given?
    @_options = Options.new(require_args: require_args, &block).options
  else
    @_options ||= {}
  end
end

#post_process(callable) ⇒ Object



21
22
23
# File 'lib/metacrunch/job/dsl.rb', line 21

def post_process(callable)
  @_job.post_process = callable
end

#pre_process(callable) ⇒ Object



17
18
19
# File 'lib/metacrunch/job/dsl.rb', line 17

def pre_process(callable)
  @_job.pre_process = callable
end

#source(source) ⇒ Object



9
10
11
# File 'lib/metacrunch/job/dsl.rb', line 9

def source(source)
  @_job.source = source
end

#transformation(callable, buffer_size: nil, buffer: nil) ⇒ Object



25
26
27
# File 'lib/metacrunch/job/dsl.rb', line 25

def transformation(callable, buffer_size: nil, buffer: nil)
  @_job.add_transformation(callable, buffer_size: buffer_size, buffer: buffer)
end