Class: Protobuf::Rpc::HttpRunner
- Inherits:
-
Object
- Object
- Protobuf::Rpc::HttpRunner
- Defined in:
- lib/protobuf/rpc/servers/http_runner.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ HttpRunner
constructor
A new instance of HttpRunner.
- #run ⇒ Object
- #running? ⇒ Boolean
- #stop ⇒ Object
Constructor Details
#initialize(options) ⇒ HttpRunner
Returns a new instance of HttpRunner.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/protobuf/rpc/servers/http_runner.rb', line 5 def initialize() @options = case when .is_a?(OpenStruct) then .marshal_dump when .is_a?(Hash) then when .respond_to?(:to_hash) then .to_hash else raise "Cannot parse HTTP Server - server options" end @server = ::Protobuf::Rpc::Http::Server.new(@options) end |
Instance Method Details
#run ⇒ Object
20 21 22 23 |
# File 'lib/protobuf/rpc/servers/http_runner.rb', line 20 def run yield if block_given? @server.run end |
#running? ⇒ Boolean
25 26 27 |
# File 'lib/protobuf/rpc/servers/http_runner.rb', line 25 def running? @server.running? end |
#stop ⇒ Object
29 30 31 |
# File 'lib/protobuf/rpc/servers/http_runner.rb', line 29 def stop @server.stop end |