Sha256: e2c2e0cf50a9b8a7d3e1ca3ef1fc0cb85db49ee86a6588d1b234e9e3f3b7b9c1

Contents?: true

Size: 762 Bytes

Versions: 4

Compression:

Stored size: 762 Bytes

Contents

module Protobuf
  module Rpc
    class SocketRunner

      private

      attr_accessor :server

      public

      def initialize(options)
        options = case
                   when options.is_a?(OpenStruct) then
                     options.marshal_dump
                   when options.respond_to?(:to_hash) then
                     options.to_hash.symbolize_keys
                   else
                     fail "Cannot parser Socket Server - server options"
                   end

        self.server = ::Protobuf::Rpc::Socket::Server.new(options)
      end

      def run
        yield if block_given?
        server.run
      end

      def running?
        server.running?
      end

      def stop
        server.stop
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
protobuf-3.5.4 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.5.3 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.5.2 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.5.1 lib/protobuf/rpc/servers/socket_runner.rb