Class: MiniDisc::Discover::Service
- Inherits:
-
Object
- Object
- MiniDisc::Discover::Service
- Includes:
- Comparable
- Defined in:
- lib/minidisc/discover.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(id, host, options = {}) ⇒ Service
constructor
A new instance of Service.
- #to_h ⇒ Object
Constructor Details
#initialize(id, host, options = {}) ⇒ Service
Returns a new instance of Service.
73 74 75 76 77 |
# File 'lib/minidisc/discover.rb', line 73 def initialize(id, host, = {}) @id = id @host = host @port = .fetch(:port, 8080) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
71 72 73 |
# File 'lib/minidisc/discover.rb', line 71 def host @host end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
71 72 73 |
# File 'lib/minidisc/discover.rb', line 71 def id @id end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
71 72 73 |
# File 'lib/minidisc/discover.rb', line 71 def port @port end |
Instance Method Details
#<=>(other) ⇒ Object
79 80 81 |
# File 'lib/minidisc/discover.rb', line 79 def <=>(other) to_h <=> other.to_h end |
#to_h ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/minidisc/discover.rb', line 83 def to_h { id: @id, host: @host, port: @port } end |