Class: Ripe::DSL::WorkflowDSL

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

Overview

This class provides a DSL for defining a workflow. It should only be called by #workflow.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle, &block) ⇒ WorkflowDSL

Create a new Workflow DSL

Parameters:

  • handle (String)

    the name of the workflow

  • block (Proc)

    executes block in the context of WorkflowDSL



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ripe/dsl/workflow_dsl.rb', line 56

def initialize(handle, &block)
  @handle = handle
  @params = { handle: handle }
  @callback = nil

  if block_given?
    if block.arity == 1
      yield self
    else
      instance_eval &block
    end
  end
end

Instance Attribute Details

#callbackProc (readonly)

the block describing what to do apply to each sample

Returns:

  • (Proc)

    the current value of callback



46
47
48
# File 'lib/ripe/dsl/workflow_dsl.rb', line 46

def callback
  @callback
end

#handleString (readonly)

the name of the workflow

Returns:

  • (String)

    the current value of handle



46
47
48
# File 'lib/ripe/dsl/workflow_dsl.rb', line 46

def handle
  @handle
end

#paramsHash<Symbol, String> (readonly)

list of parameters

Returns:

  • (Hash<Symbol, String>)

    the current value of params



46
47
48
# File 'lib/ripe/dsl/workflow_dsl.rb', line 46

def params
  @params
end

Instance Method Details

#describe(&block) ⇒ Object

Describe the workflow in terms of a task.

Parameters:

  • block (Proc)

    a callback function that takes as arguments the name of sample and a hash of parameters provided by the workflow and by the command line.

See Also:



89
90
91
# File 'lib/ripe/dsl/workflow_dsl.rb', line 89

def describe(&block)
  @callback = block
end

#param(key, value) ⇒ Object

Register a parameter

Parameters:

  • key (Symbol)

    the parameter name

  • value (String)

    its value



76
77
78
# File 'lib/ripe/dsl/workflow_dsl.rb', line 76

def param(key, value)
  @params.merge!({ key => value })
end