Class: Shared::Group Abstract
Overview
This class is abstract.
A collection of one or more nodes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#installations ⇒ Installations
readonly
The group’s installations.
-
#name ⇒ String
readonly
The group’s name.
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(location, client, nodes_class, installations_class) ⇒ Group
constructor
A new instance of Group.
-
#nodes ⇒ GroupableNode[]
The group’s nodes.
-
#to_s ⇒ String
A string representation of the group.
Constructor Details
#initialize(location, client, nodes_class, installations_class) ⇒ Group
Returns a new instance of Group.
53 54 55 56 57 58 |
# File 'lib/vas/shared/groups.rb', line 53 def initialize(location, client, nodes_class, installations_class) super(location, client) @name = details["name"] @installations = installations_class.new(Util::LinkUtils.get_link_href(details, "installations"), client) @nodes_class = nodes_class end |
Instance Attribute Details
#installations ⇒ Installations (readonly)
Returns the group’s installations.
47 48 49 |
# File 'lib/vas/shared/groups.rb', line 47 def installations @installations end |
#name ⇒ String (readonly)
Returns the group’s name.
50 51 52 |
# File 'lib/vas/shared/groups.rb', line 50 def name @name end |
Instance Method Details
#nodes ⇒ GroupableNode[]
Returns the group’s nodes.
63 64 65 66 67 |
# File 'lib/vas/shared/groups.rb', line 63 def nodes nodes = [] Util::LinkUtils.get_link_hrefs(client.get(location), "node").each { |node_location| nodes << @nodes_class.new(node_location, client)} nodes end |
#to_s ⇒ String
Returns a string representation of the group.
70 71 72 |
# File 'lib/vas/shared/groups.rb', line 70 def to_s "#<#{self.class} name='#@name'>" end |