Class: Maestro::Role

Inherits:
Object
  • Object
show all
Includes:
Validator
Defined in:
lib/maestro/role.rb

Overview

A role that a Node in a Cloud can play

Instance Attribute Summary collapse

Attributes included from Validator

#valid, #validation_errors

Instance Method Summary collapse

Methods included from Validator

#invalidate, #valid?, #validate

Constructor Details

#initialize(name, cloud, &block) ⇒ Role

Returns a new instance of Role.

Raises:

  • (StandardError)


14
15
16
17
18
19
20
# File 'lib/maestro/role.rb', line 14

def initialize(name, cloud, &block)
  super()
  raise StandardError, "Role name cannot contain spaces: #{name}" if name.is_a?(String) && !name.index(/\s/).nil?
  @name = name
  @cloud = cloud
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#cloudObject (readonly)

the Cloud this Role belongs to



11
12
13
# File 'lib/maestro/role.rb', line 11

def cloud
  @cloud
end

#nameObject (readonly)

the name of this Role



9
10
11
# File 'lib/maestro/role.rb', line 9

def name
  @name
end