Class: Shared::Group Abstract
- Includes:
- Deletable
- Defined in:
- lib/vas/shared/groups.rb
Overview
This class is abstract.
A collection of one or more nodes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The group’s name.
Attributes included from Deletable
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(location, client, nodes_class, installations_class) ⇒ Group
constructor
A new instance of Group.
-
#installations ⇒ Installations
The group’s installations.
-
#nodes ⇒ GroupableNode[]
The group’s nodes.
-
#reload ⇒ Object
Reloads the group’s details from the server.
-
#to_s ⇒ String
A string representation of the group.
Methods included from Deletable
Constructor Details
#initialize(location, client, nodes_class, installations_class) ⇒ Group
Returns a new instance of Group.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/vas/shared/groups.rb', line 50 def initialize(location, client, nodes_class, installations_class) super(location, client) @installations_class = installations_class @nodes_class = nodes_class @installations_location = Util::LinkUtils.get_link_href(details, 'installations') @name = details['name'] end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns the group’s name.
47 48 49 |
# File 'lib/vas/shared/groups.rb', line 47 def name @name end |
Instance Method Details
#installations ⇒ Installations
Returns the group’s installations.
68 69 70 |
# File 'lib/vas/shared/groups.rb', line 68 def installations @installations ||= @installations_class.new(@installations_location, client) end |
#nodes ⇒ GroupableNode[]
Returns the group’s nodes.
75 76 77 |
# File 'lib/vas/shared/groups.rb', line 75 def nodes @nodes ||= create_resources_from_links('node', @nodes_class) end |
#reload ⇒ Object
Reloads the group’s details from the server
62 63 64 65 |
# File 'lib/vas/shared/groups.rb', line 62 def reload super @nodes = nil end |
#to_s ⇒ String
Returns a string representation of the group.
80 81 82 |
# File 'lib/vas/shared/groups.rb', line 80 def to_s "#<#{self.class} name='#@name'>" end |