Class: PuppetX::SLURM::ArrayProperty

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

Overview

Class to share among array properties

Instance Method Summary collapse

Instance Method Details

#change_to_s(currentvalue, newvalue) ⇒ Object



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

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

#insync?(is) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/puppet_x/slurm/array_property.rb', line 3

def insync?(is)
  Array(is).sort == Array(@should).sort
end

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

rubocop:disable Style/PredicateName



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

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