Class: MockServer::SocketAddress
- Inherits:
-
Object
- Object
- MockServer::SocketAddress
- Defined in:
- lib/mockserver/models.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host: nil, port: nil, scheme: nil) ⇒ SocketAddress
constructor
A new instance of SocketAddress.
- #to_h ⇒ Object
Constructor Details
#initialize(host: nil, port: nil, scheme: nil) ⇒ SocketAddress
Returns a new instance of SocketAddress.
495 496 497 498 499 |
# File 'lib/mockserver/models.rb', line 495 def initialize(host: nil, port: nil, scheme: nil) @host = host @port = port @scheme = scheme end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
493 494 495 |
# File 'lib/mockserver/models.rb', line 493 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
493 494 495 |
# File 'lib/mockserver/models.rb', line 493 def port @port end |
#scheme ⇒ Object
Returns the value of attribute scheme.
493 494 495 |
# File 'lib/mockserver/models.rb', line 493 def scheme @scheme end |
Class Method Details
.from_hash(data) ⇒ Object
509 510 511 512 513 514 515 516 517 |
# File 'lib/mockserver/models.rb', line 509 def self.from_hash(data) return nil if data.nil? new( host: data['host'], port: data['port'], scheme: data['scheme'] ) end |
Instance Method Details
#to_h ⇒ Object
501 502 503 504 505 506 507 |
# File 'lib/mockserver/models.rb', line 501 def to_h MockServer.strip_none({ 'host' => @host, 'port' => @port, 'scheme' => @scheme }) end |