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

Version Path
factor-connector-api-0.0.14 ./lib/builders/service_builder.rb
factor-connector-api-0.0.13 ./lib/builders/service_builder.rb
factor-connector-api-0.0.12 ./lib/builders/service_builder.rb
factor-connector-api-0.0.11 ./lib/builders/service_builder.rb
factor-connector-api-0.0.10 ./lib/builders/service_builder.rb
factor-connector-api-0.0.9 ./lib/builders/service_builder.rb
factor-connector-api-0.0.8 ./lib/builders/service_builder.rb
factor-connector-api-0.0.7 ./lib/builders/service_builder.rb
factor-connector-api-0.0.6 ./lib/builders/service_builder.rb
factor-connector-api-0.0.5 ./lib/builders/service_builder.rb
factor-connector-api-0.0.4 ./lib/builders/service_builder.rb
factor-connector-api-0.0.3 ./lib/builders/service_builder.rb
factor-connector-api-0.0.2 ./lib/builders/service_builder.rb
factor-connector-api-0.0.1 ./lib/builders/service_builder.rb