# class Puppet::Property::List

This subclass of {Puppet::Property} manages an unordered list of values. For an ordered list see {Puppet::Property::OrderedList}.

### Public Instance Methods

add_should_with_current(should, current) click to toggle source

    # File lib/puppet/property/list.rb, line 27
    def add_should_with_current(should, current)
      should += current if current.is_a?(Array)
      should.uniq
    end

dearrayify(array) click to toggle source

dearrayify was motivated because to simplify the implementation of the OrderedList property

    # File lib/puppet/property/list.rb, line 37
    def dearrayify(array)
      array.sort.join(delimiter)
    end

delimiter() click to toggle source

    # File lib/puppet/property/list.rb, line 51
    def delimiter
      ","
    end

inclusive?() click to toggle source

    # File lib/puppet/property/list.rb, line 32
    def inclusive?
      @resource[membership] == :inclusive
    end

insync?(is) click to toggle source

    # File lib/puppet/property/list.rb, line 71
    def insync?(is)
      return true unless is

      (prepare_is_for_comparison(is) == self.should)
    end

is_to_s(currentvalue) click to toggle source

    # File lib/puppet/property/list.rb, line 15
    def is_to_s(currentvalue)
      if currentvalue == :absent
        return "absent"
      else
        return currentvalue.join(delimiter)
      end
    end

membership() click to toggle source

    # File lib/puppet/property/list.rb, line 23
    def membership
      :membership
    end

prepare_is_for_comparison(is) click to toggle source

    # File lib/puppet/property/list.rb, line 64
    def prepare_is_for_comparison(is)
      if is == :absent
        is = []
      end
      dearrayify(is)
    end

retrieve() click to toggle source

    # File lib/puppet/property/list.rb, line 55
    def retrieve
      #ok, some 'convention' if the list property is named groups, provider should implement a groups method
      if tmp = provider.send(name) and tmp != :absent
        return tmp.split(delimiter)
      else
        return :absent
      end
    end

should() click to toggle source

    # File lib/puppet/property/list.rb, line 41
    def should
      return nil unless @should

      members = @should
      #inclusive means we are managing everything so if it isn't in should, its gone
      members = add_should_with_current(members, retrieve) if ! inclusive?

      dearrayify(members)
    end

should_to_s(should_value) click to toggle source

    # File lib/puppet/property/list.rb, line 10
    def should_to_s(should_value)
      #just return the should value
      should_value
    end