Class: HostRequirement

Inherits:
HasAttributes show all
Defined in:
lib/hosties/Definitions.rb

Overview

Defines what a host of a certain type looks like

Instance Attribute Summary collapse

Attributes inherited from HasAttributes

#attributes, #constraints

Instance Method Summary collapse

Methods inherited from HasAttributes

#have_attributes, #valid?, #where

Constructor Details

#initialize(type) ⇒ HostRequirement

Returns a new instance of HostRequirement.



59
60
61
62
63
# File 'lib/hosties/Definitions.rb', line 59

def initialize(type)
  super()
  @type = type
  @services = []
end

Instance Attribute Details

#servicesObject (readonly)

Returns the value of attribute services.



58
59
60
# File 'lib/hosties/Definitions.rb', line 58

def services
  @services
end

#typeObject (readonly)

Returns the value of attribute type.



58
59
60
# File 'lib/hosties/Definitions.rb', line 58

def type
  @type
end

Instance Method Details

#finishedObject



75
76
77
# File 'lib/hosties/Definitions.rb', line 75

def finished
  Hosties::HostDefinitions[@type] = self
end

#have_services(service, *more) ⇒ Object Also known as: have_service

Services will be provided with a host definition. In order for a host definition to be valid, it must provide service details for all of the services specified by its matching HostRequirement



69
70
71
# File 'lib/hosties/Definitions.rb', line 69

def have_services(service, *more)
 @services += (more << service)
end