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.



6
7
8
9
# File 'lib/megam/mixins/policies.rb', line 6

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.



4
5
6
# File 'lib/megam/mixins/policies.rb', line 4

def bind_type
  @bind_type
end

#policymembersObject (readonly)

Returns the value of attribute policymembers.



4
5
6
# File 'lib/megam/mixins/policies.rb', line 4

def policymembers
  @policymembers
end

Instance Method Details

#to_arrayObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/megam/mixins/policies.rb', line 11

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