Class: Shared::Group Abstract

Inherits:
Resource show all
Includes:
Deletable
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 included from Deletable

#collection

Attributes inherited from Resource

#location, #security

Instance Method Summary collapse

Methods included from Deletable

#delete

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

#nameString (readonly)

Returns the group’s name.

Returns:

  • (String)

    the group’s name



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

def name
  @name
end

Instance Method Details

#installationsInstallations

Returns the group’s installations.

Returns:



68
69
70
# File 'lib/vas/shared/groups.rb', line 68

def installations
  @installations ||= @installations_class.new(@installations_location, client)
end

#nodesGroupableNode[]

Returns the group’s nodes.

Returns:



75
76
77
# File 'lib/vas/shared/groups.rb', line 75

def nodes
  @nodes ||= create_resources_from_links('node', @nodes_class)
end

#reloadObject

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_sString

Returns a string representation of the group.

Returns:

  • (String)

    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