Class: ThriftClient::Simple::ThriftService

### Home Classes Methods

### In Files

- lib/thrift_client/simple.rb

### Parent

Object

### Methods

- ::_arg_structs
- ::new
- ::thrift_method
- #_proxy

### Files

- CHANGELOG
- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- ThriftClient
- ThriftClient::NoServersAvailable
- ThriftClient::Simple
- ThriftClient::Simple::ComplexType
- ThriftClient::Simple::ComplexType::Extends
- ThriftClient::Simple::ComplexType::Includes
- ThriftClient::Simple::Field
- ThriftClient::Simple::ThriftException
- ThriftClient::Simple::ThriftService
- ThriftClient::Simple::ThriftStruct
- ThriftClient::Simple::ThriftStruct::Extend
- ThriftClient::Simple::ThriftStruct::Include
- Thrift
- Thrift::BaseTransport
- Thrift::BufferedTransport
- Thrift::Client
- Thrift::EventMachineConnection
- Thrift::EventMachineTransport
- Thrift::FramedTransport
- Connection
- Connection::Base
- Connection::Factory
- Connection::HTTP
- Connection::Socket
- AbstractThriftClient
- AbstractThriftClient::Server

No matching classes.

# ThriftClient::Simple::ThriftService

### Public Class Methods

_arg_structs() click to toggle source

    # File lib/thrift_client/simple.rb, line 240
    def self._arg_structs
      @_arg_structs = {} if @_arg_structs.nil?
      @_arg_structs
    end

new(sock) click to toggle source

    # File lib/thrift_client/simple.rb, line 236
    def initialize(sock)
      @sock = sock
    end

thrift_method(name, rtype, *args) click to toggle source

    # File lib/thrift_client/simple.rb, line 245
    def self.thrift_method(name, rtype, *args)
      arg_struct = ThriftClient::Simple.make_struct("Args__#{self.name}__#{name}", *args)
      rv_struct = ThriftClient::Simple.make_struct("Retval__#{self.name}__#{name}", ThriftClient::Simple::Field.new(:rv, rtype, 0))
      _arg_structs[name.to_sym] = [ arg_struct, rv_struct ]

      arg_names = args.map { |a| a.name.to_s }.join(", ")
      class_eval "def #{name}(#{arg_names}); _proxy(:#{name}#{args.size > 0 ? ', ' : ''}#{arg_names}); end"
    end

### Public Instance Methods

_proxy(method_name, *args) click to toggle source

    # File lib/thrift_client/simple.rb, line 254
    def _proxy(method_name, *args)
      cls = self.class.ancestors.find { |cls| cls.respond_to?(:_arg_structs) and cls._arg_structs[method_name.to_sym] }
      arg_class, rv_class = cls._arg_structs[method_name.to_sym]
      arg_struct = arg_class.new(*args)
      @sock.write(ThriftClient::Simple.pack_request(method_name, arg_struct))
      rv = ThriftClient::Simple.read_response(@sock, rv_class)
      rv[2]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.