Class: Megam::Mixins::Policies

Inherits:
Object
  • Object
show all
Defined in:
lib/megam/mixins/policies.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Policies

Returns a new instance of Policies.



21
22
23
24
# File 'lib/megam/mixins/policies.rb', line 21

def initialize(params)
  @bind_type = params[:bind_type] if params.key?(:bind_type)
  @policymembers = params[:policymembers] if params.key?(:policymembers)
end

Instance Attribute Details

#bind_typeObject (readonly)

Returns the value of attribute bind_type.



19
20
21
# File 'lib/megam/mixins/policies.rb', line 19

def bind_type
  @bind_type
end

#policymembersObject (readonly)

Returns the value of attribute policymembers.



19
20
21
# File 'lib/megam/mixins/policies.rb', line 19

def policymembers
  @policymembers
end

Instance Method Details

#to_arrayObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/megam/mixins/policies.rb', line 26

def to_array
  com = []
  if @bind_type && @bind_type != 'Unbound service'
    value = {
      name: 'bind policy',
      ptype: 'colocated',
      members: [
        @policymembers
      ]
    }
    com << value
  end
  com
end