Class: OodCluster::Server
- Inherits:
-
Object
- Object
- OodCluster::Server
- Includes:
- JsonSerializer
- Defined in:
- lib/ood_cluster/server.rb
Overview
An object that describes a server hosted by a given cluster
Direct Known Subclasses
OodCluster::Servers::Ganglia, OodCluster::Servers::Moab, OodCluster::Servers::Ssh, OodCluster::Servers::Torque
Instance Attribute Summary collapse
-
#host ⇒ String
readonly
The host information for this server object.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
The comparison operator.
-
#eql?(other) ⇒ Boolean
Check whether objects are identical to each other.
-
#hash ⇒ Fixnum
Generate a hash value for this object.
-
#initialize(host:, **_) ⇒ Server
constructor
A new instance of Server.
-
#to_h ⇒ Hash
Convert object to hash.
Methods included from JsonSerializer
Constructor Details
#initialize(host:, **_) ⇒ Server
Returns a new instance of Server.
15 16 17 |
# File 'lib/ood_cluster/server.rb', line 15 def initialize(host:, **_) @host = host.to_s end |
Instance Attribute Details
#host ⇒ String (readonly)
The host information for this server object
12 13 14 |
# File 'lib/ood_cluster/server.rb', line 12 def host @host end |
Instance Method Details
#==(other) ⇒ Boolean
The comparison operator
28 29 30 |
# File 'lib/ood_cluster/server.rb', line 28 def ==(other) to_h == other.to_h end |
#eql?(other) ⇒ Boolean
Check whether objects are identical to each other
35 36 37 |
# File 'lib/ood_cluster/server.rb', line 35 def eql?(other) self.class == other.class && self == other end |
#hash ⇒ Fixnum
Generate a hash value for this object
41 42 43 |
# File 'lib/ood_cluster/server.rb', line 41 def hash [self.class, to_h].hash end |
#to_h ⇒ Hash
Convert object to hash
21 22 23 |
# File 'lib/ood_cluster/server.rb', line 21 def to_h {host: @host.to_s} end |