Sha256: 0e7028dfa9829bafa548e2bd236041027eae1890b5d44df2cd13ea23de480c8c

Contents?: true

Size: 732 Bytes

Versions: 8

Compression:

Stored size: 732 Bytes

Contents

module BERTRPC
  class Service
    attr_accessor :host, :port

    def initialize(host, port)
      @host = host
      @port = port
    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

8 entries across 8 versions & 2 rubygems

Version Path
mojombo-bertrpc-0.3.0 lib/bertrpc/service.rb
mojombo-bertrpc-0.3.2 lib/bertrpc/service.rb
bertrpc-1.0.0 lib/bertrpc/service.rb
bertrpc-0.4.0 lib/bertrpc/service.rb
bertrpc-0.3.4 lib/bertrpc/service.rb
bertrpc-0.3.2 lib/bertrpc/service.rb
bertrpc-0.3.1 lib/bertrpc/service.rb
bertrpc-0.3.0 lib/bertrpc/service.rb