Class: Nvoi::Configuration::Server
- Inherits:
-
Object
- Object
- Nvoi::Configuration::Server
- Defined in:
- lib/nvoi/configuration/server.rb
Overview
Server contains server instance configuration
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#location ⇒ Object
Returns the value of attribute location.
-
#master ⇒ Object
Returns the value of attribute master.
-
#type ⇒ Object
Returns the value of attribute type.
-
#volumes ⇒ Object
Returns the value of attribute volumes.
Instance Method Summary collapse
-
#initialize(data = nil) ⇒ Server
constructor
A new instance of Server.
- #master? ⇒ Boolean
- #volume(name) ⇒ Object
Constructor Details
#initialize(data = nil) ⇒ Server
Returns a new instance of Server.
21 22 23 24 25 26 27 28 |
# File 'lib/nvoi/configuration/server.rb', line 21 def initialize(data = nil) data ||= {} @master = data["master"] || false @type = data["type"] @location = data["location"] @count = data["count"]&.to_i || 1 @volumes = (data["volumes"] || {}).transform_values { |v| ServerVolume.new(v) } end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
19 20 21 |
# File 'lib/nvoi/configuration/server.rb', line 19 def count @count end |
#location ⇒ Object
Returns the value of attribute location.
19 20 21 |
# File 'lib/nvoi/configuration/server.rb', line 19 def location @location end |
#master ⇒ Object
Returns the value of attribute master.
19 20 21 |
# File 'lib/nvoi/configuration/server.rb', line 19 def master @master end |
#type ⇒ Object
Returns the value of attribute type.
19 20 21 |
# File 'lib/nvoi/configuration/server.rb', line 19 def type @type end |
#volumes ⇒ Object
Returns the value of attribute volumes.
19 20 21 |
# File 'lib/nvoi/configuration/server.rb', line 19 def volumes @volumes end |
Instance Method Details
#master? ⇒ Boolean
30 31 32 |
# File 'lib/nvoi/configuration/server.rb', line 30 def master? @master == true end |
#volume(name) ⇒ Object
34 35 36 |
# File 'lib/nvoi/configuration/server.rb', line 34 def volume(name) @volumes[name.to_s] end |