Class: Ripe::DSL::TaskDSL

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle, &block) ⇒ TaskDSL

Create a new Task DSL

Parameters:

  • handle (String)

    the name of the task

  • block (Proc)

    executes block in the context of TaskDSL



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/ripe/dsl/task_dsl.rb', line 72

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

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

Instance Attribute Details

#paramsHash<Symbol, String> (readonly)

list of parameters

Returns:

  • (Hash<Symbol, String>)

    the current value of params



62
63
64
# File 'lib/ripe/dsl/task_dsl.rb', line 62

def params
  @params
end

Instance Method Details

#param(key, value) ⇒ Object

Register a parameter

Parameters:

  • key (Symbol)

    the parameter name

  • value (String)

    its value



91
92
93
# File 'lib/ripe/dsl/task_dsl.rb', line 91

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