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.
475 476 477 478 479 |
# File 'lib/mockserver/models.rb', line 475 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.
473 474 475 |
# File 'lib/mockserver/models.rb', line 473 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
473 474 475 |
# File 'lib/mockserver/models.rb', line 473 def port @port end |
#scheme ⇒ Object
Returns the value of attribute scheme.
473 474 475 |
# File 'lib/mockserver/models.rb', line 473 def scheme @scheme end |
Class Method Details
.from_hash(data) ⇒ Object
489 490 491 492 493 494 495 496 497 |
# File 'lib/mockserver/models.rb', line 489 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
481 482 483 484 485 486 487 |
# File 'lib/mockserver/models.rb', line 481 def to_h MockServer.strip_none({ 'host' => @host, 'port' => @port, 'scheme' => @scheme }) end |