Sha256: 1b492864ac3cde5a69774e84b6efa0ab8383388a251fb90f0cbdeccda181d5c2

Contents?: true

Size: 783 Bytes

Versions: 9

Compression:

Stored size: 783 Bytes

Contents

module BERTRPC
  class Service
    attr_accessor :host, :port, :timeout

    def initialize(host, port, timeout = nil)
      @host = host
      @port = port
      @timeout = timeout
    end

    def call(options = nil)
      verify_options(options)
      Request.new(self, :call, options)
    end

    def cast(options = nil)
      verify_options(options)
      Request.new(self, :cast, options)
    end

    # private

    def verify_options(options)
      if options
        if cache = options[:cache]
          unless cache[0] == :validation && cache[1].is_a?(String)
            raise InvalidOption.new("Valid :cache args are [:validation, String]")
          end
        else
          raise InvalidOption.new("Valid options are :cache")
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bertrpc-1.3.1 lib/bertrpc/service.rb
bertrpc-1.3.0 lib/bertrpc/service.rb
bertrpc-1.2.1 lib/bertrpc/service.rb
bertrpc-1.2.0 lib/bertrpc/service.rb
bertrpc-0.4.2 lib/bertrpc/service.rb
bertrpc-1.1.2 lib/bertrpc/service.rb
bertrpc-0.4.1 lib/bertrpc/service.rb
bertrpc-1.1.1 lib/bertrpc/service.rb
bertrpc-1.1.0 lib/bertrpc/service.rb