Sha256: b0db2cb7f7c829eb960382b97160f96b33f998bd692a0619a21e2c55cc906d0a
Contents?: true
Size: 701 Bytes
Versions: 14
Compression:
Stored size: 701 Bytes
Contents
# encoding: UTF-8 # DSL for building services module Factor module Connector class ServiceBuilder def initialize(id, &block) @listeners = {} @actions = {} @id = id.to_s instance_eval(&block) if block end def listener(id, &block) listener = ListenerBuilder.new(id, &block).build @listeners[listener.id] = listener end def action(id, &block) action = ActionBuilder.new(id, &block).build @actions[action.id] = action end def build sd = ServiceDefinition.new sd.listeners = @listeners sd.actions = @actions sd.id = @id sd end end end end
Version data entries
14 entries across 14 versions & 1 rubygems