diff options
author | Luke Kanies <luke@madstop.com> | 2005-04-13 18:20:25 +0000 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2005-04-13 18:20:25 +0000 |
commit | c45c5c4fff877c3d13af2ba9a5db94fa16a5473c (patch) | |
tree | 967bfdf3cf1399395080a5b1055ffe27fdc722d6 /lib/blink/function.rb | |
parent | 06734a90d321e792492b0ca85b169b91ab463a15 (diff) | |
download | puppet-c45c5c4fff877c3d13af2ba9a5db94fa16a5473c.tar.gz puppet-c45c5c4fff877c3d13af2ba9a5db94fa16a5473c.tar.xz puppet-c45c5c4fff877c3d13af2ba9a5db94fa16a5473c.zip |
renaming
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@110 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/blink/function.rb')
-rw-r--r-- | lib/blink/function.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/blink/function.rb b/lib/blink/function.rb new file mode 100644 index 000000000..66620c514 --- /dev/null +++ b/lib/blink/function.rb @@ -0,0 +1,41 @@ +#!/usr/local/bin/ruby -w + +# $Id$ + +require 'blink' +require 'blink/fact' + +module Blink + class Function + @@functions = Hash.new(nil) + + #--------------------------------------------------------------- + def [](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("retrieve", proc { |fact| + require 'blink/fact' + + return Fact[fact] + }) +end |