Class: Cuboid::RPC::Server::Base
- Defined in:
- lib/cuboid/rpc/server/base.rb
Overview
RPC server class
Instance Method Summary collapse
- #address ⇒ Object
-
#initialize(options = nil, token = nil) ⇒ Base
constructor
A new instance of Base.
- #port ⇒ Object
- #ready? ⇒ Boolean
- #start ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(options = nil, token = nil) ⇒ Base
Returns a new instance of Base.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cuboid/rpc/server/base.rb', line 24 def initialize( = nil, token = nil ) # If given nil use the global defaults. ||= Options.rpc. = super(.merge( serializer: Serializer, token: token )) return if @reactor.running? @reactor.run_in_thread end |
Instance Method Details
#address ⇒ Object
39 40 41 |
# File 'lib/cuboid/rpc/server/base.rb', line 39 def address [:external_address] || [:host] end |
#port ⇒ Object
43 44 45 |
# File 'lib/cuboid/rpc/server/base.rb', line 43 def port [:port] end |
#ready? ⇒ Boolean
58 59 60 |
# File 'lib/cuboid/rpc/server/base.rb', line 58 def ready? @ready ||= false end |
#start ⇒ Object
53 54 55 56 |
# File 'lib/cuboid/rpc/server/base.rb', line 53 def start super @ready = true end |
#url ⇒ Object
47 48 49 50 51 |
# File 'lib/cuboid/rpc/server/base.rb', line 47 def url return [:socket] if [:socket] "#{address}:#{port}" end |