Class: Nvoi::Configuration::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/nvoi/configuration/server.rb

Overview

Server contains server instance configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#countObject

Returns the value of attribute count.



19
20
21
# File 'lib/nvoi/configuration/server.rb', line 19

def count
  @count
end

#locationObject

Returns the value of attribute location.



19
20
21
# File 'lib/nvoi/configuration/server.rb', line 19

def location
  @location
end

#masterObject

Returns the value of attribute master.



19
20
21
# File 'lib/nvoi/configuration/server.rb', line 19

def master
  @master
end

#typeObject

Returns the value of attribute type.



19
20
21
# File 'lib/nvoi/configuration/server.rb', line 19

def type
  @type
end

#volumesObject

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

Returns:

  • (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