Class: OodCore::Job::NodeInfo
- Inherits:
-
Object
- Object
- OodCore::Job::NodeInfo
- Defined in:
- lib/ood_core/job/node_info.rb
Overview
An object that describes the resources used on a specific node.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The name of the host machine.
-
#procs ⇒ Integer?
readonly
The number of procs reserved on the given machine.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
The comparison operator.
-
#eql?(other) ⇒ Boolean
Whether objects are identical to each other.
-
#hash ⇒ Integer
Generate a hash value for this object.
-
#initialize(name:, procs: nil, **_) ⇒ NodeInfo
constructor
A new instance of NodeInfo.
-
#to_h ⇒ Hash
Convert object to hash.
Constructor Details
#initialize(name:, procs: nil, **_) ⇒ NodeInfo
Returns a new instance of NodeInfo.
15 16 17 18 |
# File 'lib/ood_core/job/node_info.rb', line 15 def initialize(name:, procs: nil, **_) @name = name.to_s @procs = procs && procs.to_i end |
Instance Attribute Details
#name ⇒ String (readonly)
The name of the host machine
7 8 9 |
# File 'lib/ood_core/job/node_info.rb', line 7 def name @name end |
#procs ⇒ Integer? (readonly)
The number of procs reserved on the given machine
11 12 13 |
# File 'lib/ood_core/job/node_info.rb', line 11 def procs @procs end |
Instance Method Details
#==(other) ⇒ Boolean
The comparison operator
29 30 31 |
# File 'lib/ood_core/job/node_info.rb', line 29 def ==(other) to_h == other.to_h end |
#eql?(other) ⇒ Boolean
Whether objects are identical to each other
36 37 38 |
# File 'lib/ood_core/job/node_info.rb', line 36 def eql?(other) self.class == other.class && self == other end |
#hash ⇒ Integer
Generate a hash value for this object
42 43 44 |
# File 'lib/ood_core/job/node_info.rb', line 42 def hash [self.class, to_h].hash end |
#to_h ⇒ Hash
Convert object to hash
22 23 24 |
# File 'lib/ood_core/job/node_info.rb', line 22 def to_h { name: name, procs: procs } end |