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 |
# File 'lib/cuboid/rpc/server/base.rb', line 24 def initialize( = nil, token = nil ) # If given nil use the global defaults. ||= Options.rpc. @options = super(.merge( serializer: Serializer, token: token )) end |
Instance Method Details
#address ⇒ Object
36 37 38 |
# File 'lib/cuboid/rpc/server/base.rb', line 36 def address @options[:external_address] || @options[:host] end |
#port ⇒ Object
40 41 42 |
# File 'lib/cuboid/rpc/server/base.rb', line 40 def port @options[:port] end |
#ready? ⇒ Boolean
55 56 57 |
# File 'lib/cuboid/rpc/server/base.rb', line 55 def ready? @ready ||= false end |
#start ⇒ Object
50 51 52 53 |
# File 'lib/cuboid/rpc/server/base.rb', line 50 def start super @ready = true end |
#url ⇒ Object
44 45 46 47 48 |
# File 'lib/cuboid/rpc/server/base.rb', line 44 def url return @options[:socket] if @options[:socket] "#{address}:#{port}" end |