Sha256: dbf724c1749944febf02426ff3747f3683bce662da87bb0dac8d11b748a866ae

Contents?: true

Size: 825 Bytes

Versions: 8

Compression:

Stored size: 825 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.is_a?(Hash) then
                     options
                   when options.respond_to?(:to_hash) then
                     options.to_hash
                   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

8 entries across 8 versions & 2 rubygems

Version Path
prepor-protobuf-3.5.1 lib/protobuf/rpc/servers/socket_runner.rb
prepor-protobuf-3.5.0 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.5.0 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.4.4 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.4.3 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.4.2 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.4.1 lib/protobuf/rpc/servers/socket_runner.rb
protobuf-3.4.0 lib/protobuf/rpc/servers/socket_runner.rb