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.
573 574 575 576 577 |
# File 'lib/mockserver/models.rb', line 573 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.
571 572 573 |
# File 'lib/mockserver/models.rb', line 571 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
571 572 573 |
# File 'lib/mockserver/models.rb', line 571 def port @port end |
#scheme ⇒ Object
Returns the value of attribute scheme.
571 572 573 |
# File 'lib/mockserver/models.rb', line 571 def scheme @scheme end |
Class Method Details
.from_hash(data) ⇒ Object
587 588 589 590 591 592 593 594 595 |
# File 'lib/mockserver/models.rb', line 587 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
579 580 581 582 583 584 585 |
# File 'lib/mockserver/models.rb', line 579 def to_h MockServer.strip_none({ 'host' => @host, 'port' => @port, 'scheme' => @scheme }) end |