Class: Mxrb::Uml::Server
- Inherits:
-
Object
- Object
- Mxrb::Uml::Server
- Defined in:
- lib/mxrb/uml/server.rb
Overview
Loopback-only unified viewer for class, activity, and sequence diagrams. rubocop:disable Metrics
Constant Summary collapse
- LOOPBACK_HOSTS =
%w[127.0.0.1 ::1 localhost].freeze
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source, host: '127.0.0.1', port: 4569) ⇒ Server
constructor
A new instance of Server.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(source, host: '127.0.0.1', port: 4569) ⇒ Server
Returns a new instance of Server.
18 19 20 21 22 23 24 25 26 |
# File 'lib/mxrb/uml/server.rb', line 18 def initialize(source, host: '127.0.0.1', port: 4569) @source = File.(source) raise ArgumentError, "MPR not found: #{@source}" unless File.file?(@source) @host = host.to_s raise ArgumentError, 'UML server must bind to loopback' unless LOOPBACK_HOSTS.include?(@host) @port = Integer(port) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
16 17 18 |
# File 'lib/mxrb/uml/server.rb', line 16 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
16 17 18 |
# File 'lib/mxrb/uml/server.rb', line 16 def port @port end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
16 17 18 |
# File 'lib/mxrb/uml/server.rb', line 16 def source @source end |
Instance Method Details
#shutdown ⇒ Object
33 |
# File 'lib/mxrb/uml/server.rb', line 33 def shutdown = @server&.shutdown |