Class: CapUtil::ServerRoles::ServerDef

Inherits:
Object
  • Object
show all
Defined in:
lib/cap-util/server_roles.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname, options_list = nil) ⇒ ServerDef

Returns a new instance of ServerDef.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/cap-util/server_roles.rb', line 64

def initialize(hostname, options_list = nil)
  @hostname = hostname
  @options = {}

  # so, weird cap bug.  options have to match type when using them in
  # a task's definition.  so if you have (string) 'primary' option, you
  # have to use a string in your task defs.
  # this is not the case for the role names (string or symbol works).
  # so, I'm just defining each option, both in string (how it comes from
  # the configs) and symbol form.

  (options_list || []).each do |option|
    @options[option.to_s]   = true
    @options[option.to_sym] = true
  end
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname.



62
63
64
# File 'lib/cap-util/server_roles.rb', line 62

def hostname
  @hostname
end

#optionsObject (readonly)

Returns the value of attribute options.



62
63
64
# File 'lib/cap-util/server_roles.rb', line 62

def options
  @options
end