Class: Shared::Group Abstract

Inherits:
Resource show all
Defined in:
lib/vas/shared/groups.rb

Overview

This class is abstract.

A collection of one or more nodes

Direct Known Subclasses

RabbitMq::Group, MutableGroup

Instance Attribute Summary collapse

Attributes inherited from Resource

#location, #security

Instance Method Summary collapse

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

#installationsInstallations (readonly)

Returns the group’s installations.

Returns:



47
48
49
# File 'lib/vas/shared/groups.rb', line 47

def installations
  @installations
end

#nameString (readonly)

Returns the group’s name.

Returns:

  • (String)

    the group’s name



50
51
52
# File 'lib/vas/shared/groups.rb', line 50

def name
  @name
end

Instance Method Details

#nodesGroupableNode[]

Returns the group’s nodes.

Returns:



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_sString

Returns a string representation of the group.

Returns:

  • (String)

    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