Class: PuppetX::Keycloak::ArrayProperty

Inherits:
Puppet::Property
  • Object
show all
Defined in:
lib/puppet_x/keycloak/array_property.rb

Overview

Class to share among array properties

Instance Method Summary collapse

Instance Method Details

#change_to_s(currentvalue, newvalue) ⇒ Object



13
14
15
16
17
# File 'lib/puppet_x/keycloak/array_property.rb', line 13

def change_to_s(currentvalue, newvalue)
  currentvalue = currentvalue.join(',') if currentvalue != :absent
  newvalue = newvalue.join(',')
  super(currentvalue, newvalue)
end

#insync?(is) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'lib/puppet_x/keycloak/array_property.rb', line 5

def insync?(is)
  if is.is_a?(Array) && @should.is_a?(Array)
    is.sort == @should.sort
  else
    is == @should
  end
end

#is_to_s(currentvalue) ⇒ Object Also known as: should_to_s

rubocop:disable Style/PredicateName



19
20
21
22
23
24
25
# File 'lib/puppet_x/keycloak/array_property.rb', line 19

def is_to_s(currentvalue) # rubocop:disable Style/PredicateName
  if currentvalue.is_a?(Array)
    currentvalue.join(',')
  else
    currentvalue
  end
end