diff options
author | Luke Kanies <luke@madstop.com> | 2005-08-23 16:16:38 +0000 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2005-08-23 16:16:38 +0000 |
commit | 129dad73edf2307a36f88c563a347417f75bcc12 (patch) | |
tree | 8f6dd38cd93973b18f70d5d58ab3eb15c27f556c /lib | |
parent | 51294a08463ed4735d73a9d5836f52f92396dfb0 (diff) | |
download | puppet-129dad73edf2307a36f88c563a347417f75bcc12.tar.gz puppet-129dad73edf2307a36f88c563a347417f75bcc12.tar.xz puppet-129dad73edf2307a36f88c563a347417f75bcc12.zip |
removing obsolete file
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@578 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/selector.rb | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/lib/puppet/selector.rb b/lib/puppet/selector.rb deleted file mode 100644 index 50e55fb24..000000000 --- a/lib/puppet/selector.rb +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/local/bin/ruby -w - -# $Id$ - -require 'puppet' - -module Puppet - #--------------------------------------------------------------- - # this class will provide something like a 'select' statement, but it will - # return a value - # it will be used something like this: - # value = Selector.new( - # proc { test() } => value, - # proc { test2() } => value2, - # ) - - # each test gets evaluated in turn; the first one to return true has its - # value returned as the value of the statement - # this will be used to provide abstraction in objects, but it's currently - # unused - - class Selector < Array - attr_accessor :default - - def add(value,&block) - option = Option.new(value,&block) - @ohash[value] = option - @oarray.push(option) - end - - def evaluate - @oarray.each { |option| - if option.true? - return option.value - end - } - return nil - end - - # we have to support providing different values based on - # different criteria, e.g., default is X, SunOS gets Y, and - # host Yayness gets Z. - # thus, no invariant - def initialize - @oarray = [] - @ohash = {} - - if block_given? - yield self - end - end - - def to_s - return self.evaluate() - end - - class Option - attr_accessor :value, :test, :invariant - - def initialize(value,&block) - @value = value - @test = block - end - - def to_s - if self.evaluate - return value - end - end - - def true? - unless @test.is_a?(Proc) - raise "Cannot yet evaluate non-code tests" - end - - return @test.call() - end - end - #--------------------------------------------------------------- - end -end |