Sha256: 4bfbfec7c82db391058977e75372784edbe1e2d35123739ecb9bbb16e1487f82

Contents?: true

Size: 899 Bytes

Versions: 10

Compression:

Stored size: 899 Bytes

Contents

module Auger

  class Connection
    attr_accessor :requests, :connection, :response, :roles, :options

    def self.load(port, &block)
      connection = new(port)
      connection.instance_eval(&block)
      connection
    end

    def initialize(port)
      @options = {:port => port, :timeout => 5}
      @roles = []
      @requests = []
    end

    def roles(*names)
      @roles += names if names
      @roles
    end

    ## explicit method to override use of timeout.rb in modules
    def timeout(secs)
      @options[:timeout] = secs
    end

    def method_missing(method, arg)
      @options[method] = arg
    end

    ## call plugin open() and return plugin-specific connection object, or exception
    def do_open(server)
      options = @options.merge(server.options)
      begin
        self.open(server.name, options)
      rescue => e
        e
      end
    end
    
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
auger-1.3.8 lib/auger/connection.rb
auger-1.3.7 lib/auger/connection.rb
auger-1.3.6 lib/auger/connection.rb
auger-1.3.5 lib/auger/connection.rb
auger-1.3.4 lib/auger/connection.rb
auger-1.3.3 lib/auger/connection.rb
auger-1.3.2 lib/auger/connection.rb
auger-1.3.1 lib/auger/connection.rb
auger-1.3.0 lib/auger/connection.rb
auger-1.2.4 lib/auger/connection.rb