Sha256: 128ba6fb4887b317ea9c4f64903f7a3212b8429326b7b5a0e52baf32f6806793

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

# included so we can test object types
require 'puppet'

# the base class for both types and parameters.
# very little functionality; basically just defines the interface
# and provides a few simple across-the-board functions like 'noop'
class Puppet::Element
    include Puppet
    include Puppet::Util
    include Puppet::Util::Errors
    attr_writer :noop

    class << self
        attr_accessor :doc, :nodoc
        include Puppet::Util
    end

    # all of our subclasses must respond to each of these methods...
    @@interface_methods = [
        :retrieve, :insync?, :sync, :evaluate
    ]

    # so raise an error if a method that isn't overridden gets called
    @@interface_methods.each { |method|
        self.send(:define_method,method) {
            raise Puppet::DevError, "%s(%s) has not overridden %s" %
                [self.class, self.class.name,method]
        }
    }

    Puppet::Util.logmethods(self, true)

    # for testing whether we should actually do anything
    def noop
        unless defined? @noop
            @noop = false
        end
        return @noop || Puppet[:noop] || false
    end

    # return the full path to us, for logging and rollback
    # some classes (e.g., FileTypeRecords) will have to override this
    def path
        unless defined? @path
            @path = pathbuilder
        end

        return "/" + @path.join("/")
    end
end

# $Id: element.rb 2169 2007-02-07 06:47:10Z luke $

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-0.22.4 lib/puppet/element.rb
puppet-0.23.0 lib/puppet/element.rb