summaryrefslogtreecommitdiffstats
path: root/lib/puppet/element.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-06-27 21:44:46 +0000
committerLuke Kanies <luke@madstop.com>2005-06-27 21:44:46 +0000
commit8f95084cd854aef4e3493854e58cefd352cdc68d (patch)
treef31288d1cbbd60c0fdc7c04bbd6960516a6893be /lib/puppet/element.rb
parent6f074138779e558fd7017880f606dcf3527233f9 (diff)
downloadpuppet-8f95084cd854aef4e3493854e58cefd352cdc68d.tar.gz
puppet-8f95084cd854aef4e3493854e58cefd352cdc68d.tar.xz
puppet-8f95084cd854aef4e3493854e58cefd352cdc68d.zip
renaming blink to puppet
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@302 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/element.rb')
-rw-r--r--lib/puppet/element.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/puppet/element.rb b/lib/puppet/element.rb
new file mode 100644
index 000000000..dd187977a
--- /dev/null
+++ b/lib/puppet/element.rb
@@ -0,0 +1,41 @@
+#!/usr/local/bin/ruby -w
+
+# $Id$
+
+# included so we can test object types
+require 'blink'
+
+
+#---------------------------------------------------------------
+# the base class for both types and states
+# very little functionality; basically just defines the interface
+# and provides a few simple across-the-board functions like 'noop'
+class Blink::Element
+ attr_writer :noop
+
+ #---------------------------------------------------------------
+ # all of our subclasses must respond to each of these methods...
+ @@interface_methods = [
+ :retrieve, :insync?, :sync, :fqpath, :evaluate
+ ]
+
+ # so raise an error if a method that isn't overridden gets called
+ @@interface_methods.each { |method|
+ self.send(:define_method,method) {
+ raise "%s has not overridden %s" % [self.class,method]
+ }
+ }
+ #---------------------------------------------------------------
+
+ #---------------------------------------------------------------
+ # for testing whether we should actually do anything
+ def noop
+ unless defined? @noop
+ @noop = false
+ end
+ return @noop || Blink[:noop] || false
+ end
+ #---------------------------------------------------------------
+
+end
+#---------------------------------------------------------------