Class: Bosh::Template::EvaluationLinkInstance

Inherits:
Object
  • Object
show all
Includes:
PropertyHelper
Defined in:
lib/bosh/template/evaluation_link_instance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PropertyHelper

#copy_property, #lookup_property, #set_property, #sort_property, #validate_properties_format

Constructor Details

#initialize(name, index, id, az, address, properties, bootstrap) ⇒ EvaluationLinkInstance

Returns a new instance of EvaluationLinkInstance.



16
17
18
19
20
21
22
23
24
# File 'lib/bosh/template/evaluation_link_instance.rb', line 16

def initialize(name, index, id, az, address, properties, bootstrap)
  @name = name
  @index = index
  @id = id
  @az = az
  @address = address
  @properties = properties
  @bootstrap = bootstrap
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



12
13
14
# File 'lib/bosh/template/evaluation_link_instance.rb', line 12

def address
  @address
end

#azObject (readonly)

Returns the value of attribute az.



11
12
13
# File 'lib/bosh/template/evaluation_link_instance.rb', line 11

def az
  @az
end

#bootstrapObject (readonly)

Returns the value of attribute bootstrap.



14
15
16
# File 'lib/bosh/template/evaluation_link_instance.rb', line 14

def bootstrap
  @bootstrap
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/bosh/template/evaluation_link_instance.rb', line 10

def id
  @id
end

#indexObject (readonly)

Returns the value of attribute index.



9
10
11
# File 'lib/bosh/template/evaluation_link_instance.rb', line 9

def index
  @index
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/bosh/template/evaluation_link_instance.rb', line 8

def name
  @name
end

#propertiesObject (readonly)

Returns the value of attribute properties.



13
14
15
# File 'lib/bosh/template/evaluation_link_instance.rb', line 13

def properties
  @properties
end

Instance Method Details

#if_p(*names) {|values| ... } ⇒ Object

Yields:

  • (values)


38
39
40
41
42
43
44
45
46
47
# File 'lib/bosh/template/evaluation_link_instance.rb', line 38

def if_p(*names)
  values = names.map do |name|
    value = lookup_property(@properties, name)
    return ActiveElseBlock.new(self) if value.nil?
    value
  end

  yield *values
  InactiveElseBlock.new
end

#p(*args) ⇒ Object

Raises:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bosh/template/evaluation_link_instance.rb', line 26

def p(*args)
  names = Array(args[0])

  names.each do |name|
    result = lookup_property(@properties, name)
    return result unless result.nil?
  end

  return args[1] if args.length == 2
  raise UnknownProperty.new(names)
end