Class: HostRequirement
- Inherits:
-
HasAttributes
- Object
- HasAttributes
- HostRequirement
- Defined in:
- lib/hosties/Definitions.rb
Overview
Defines what a host of a certain type looks like
Instance Attribute Summary collapse
-
#services ⇒ Object
readonly
Returns the value of attribute services.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from HasAttributes
Instance Method Summary collapse
- #finished ⇒ Object
-
#have_services(service, *more) ⇒ Object
(also: #have_service)
Services will be provided with a host definition.
-
#initialize(type) ⇒ HostRequirement
constructor
A new instance of HostRequirement.
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
#services ⇒ Object (readonly)
Returns the value of attribute services.
58 59 60 |
# File 'lib/hosties/Definitions.rb', line 58 def services @services end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
58 59 60 |
# File 'lib/hosties/Definitions.rb', line 58 def type @type end |
Instance Method Details
#finished ⇒ Object
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 |