class Robinhood::DSL

The DSL provides syntax suger on top of Robinhood’s runtime. It allows us to define processes in a natural language for the programmer’s convenience.

Public Class Methods

new(runtime) click to toggle source

Public: Initializes the DSL.

runtime - A runtime that will be configured using the DSL.

# File lib/robinhood/dsl.rb, line 12
def initialize(runtime)
  @runtime = runtime
end

Public Instance Methods

process(name, options = {}, &block) click to toggle source

Public: Adds a process to the runtime.

name - The name of the process to be run. Will be used to identify the

mutex name across System Processes.

options - A set of options that will be passed to the Process. block - A block that will be called each execution of this process.

Returns nil.

# File lib/robinhood/dsl.rb, line 24
def process(name, options = {}, &block)
  @runtime.add_process(name, options, block)
  nil
end
redis() { || ... } click to toggle source

Public: Allows a redis instance to be used to provide the locking.

Example:

Robinhood.define do

redis{ Redis.new(host: 'foo') }

end

block - A mandatory block whose result will be assigned to the runtime’s

redis client.

Returns nil.

# File lib/robinhood/dsl.rb, line 41
def redis
  @runtime.redis = yield
  nil
end