summaryrefslogtreecommitdiffstats
path: root/lib/blink/function.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/blink/function.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/blink/function.rb')
-rw-r--r--lib/blink/function.rb72
1 files changed, 0 insertions, 72 deletions
diff --git a/lib/blink/function.rb b/lib/blink/function.rb
deleted file mode 100644
index d5cc11107..000000000
--- a/lib/blink/function.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-# $Id$
-
-require 'blink'
-require 'blink/fact'
-
-module Blink
- class Function
- @@functions = Hash.new(nil)
-
- #---------------------------------------------------------------
- def Function.[](name)
- return @@functions[name]
- end
- #---------------------------------------------------------------
-
- #---------------------------------------------------------------
- def call(args)
- @code.call(args)
- end
- #---------------------------------------------------------------
-
- #---------------------------------------------------------------
- # we want a 'proc' item instead of a block, so that we can return
- # from it
- def initialize(name,code)
- @name = name
- @code = code
-
- @@functions[name] = self
- end
- #---------------------------------------------------------------
- end
-
- Function.new("fact", proc { |fact|
- require 'blink/fact'
-
- value = Fact[fact]
- Blink.debug("retrieved %s as %s" % [fact,value])
- value
- })
-
- Function.new("addfact", proc { |args|
- require 'blink/fact'
- #Blink.debug("running addfact")
-
- hash = nil
- if args.is_a?(Array)
- hash = Hash[*args]
- end
- name = nil
- if hash.has_key?("name")
- name = hash["name"]
- hash.delete("name")
- elsif hash.has_key?(:name)
- name = hash[:name]
- hash.delete(:name)
- else
- raise "Functions must have names"
- end
- #Blink.debug("adding fact %s" % name)
- newfact = Fact.add(name) { |fact|
- hash.each { |key,value|
- method = key + "="
- fact.send(method,value)
- }
- }
-
- #Blink.debug("got fact %s" % newfact)
- })
-end