diff options
author | Luke Kanies <luke@madstop.com> | 2008-02-08 14:25:52 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-02-08 14:25:52 -0600 |
commit | 5a0e34b4f8da22e1830ec7d0a730c3686665bceb (patch) | |
tree | d8635f754c2a0fee69e103cf6d85792ff4e736a1 /lib/puppet/parser/ast/selector.rb | |
parent | 82720d5327b30839a29035ee0b498b940ffc7a5a (diff) | |
download | puppet-5a0e34b4f8da22e1830ec7d0a730c3686665bceb.tar.gz puppet-5a0e34b4f8da22e1830ec7d0a730c3686665bceb.tar.xz puppet-5a0e34b4f8da22e1830ec7d0a730c3686665bceb.zip |
Refactoring the AST classes just a bit. I realized that
all of the evaluate() methods only ever accepted a scope,
and sometimes one other option, so I switched them all to
use named arguments instead of a hash.
Diffstat (limited to 'lib/puppet/parser/ast/selector.rb')
-rw-r--r-- | lib/puppet/parser/ast/selector.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/puppet/parser/ast/selector.rb b/lib/puppet/parser/ast/selector.rb index d363ab7e4..399d405a3 100644 --- a/lib/puppet/parser/ast/selector.rb +++ b/lib/puppet/parser/ast/selector.rb @@ -11,13 +11,12 @@ class Puppet::Parser::AST end # Find the value that corresponds with the test. - def evaluate(hash) - scope = hash[:scope] + def evaluate(scope) retvalue = nil found = nil # Get our parameter. - paramvalue = @param.safeevaluate(:scope => scope) + paramvalue = @param.safeevaluate(scope) sensitive = Puppet[:casesensitive] @@ -33,13 +32,13 @@ class Puppet::Parser::AST # Then look for a match in the options. @values.each { |obj| - param = obj.param.safeevaluate(:scope => scope) + param = obj.param.safeevaluate(scope) if ! sensitive && param.respond_to?(:downcase) param = param.downcase end if param == paramvalue # we found a matching option - retvalue = obj.value.safeevaluate(:scope => scope) + retvalue = obj.value.safeevaluate(scope) found = true break elsif obj.param.is_a?(Default) @@ -51,7 +50,7 @@ class Puppet::Parser::AST # Unless we found something, look for the default. unless found if default - retvalue = default.value.safeevaluate(:scope => scope) + retvalue = default.value.safeevaluate(scope) else self.fail Puppet::ParseError, "No matching value for selector param '%s'" % paramvalue |