summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2009-02-26 11:43:39 +1100
committerJames Turnbull <james@lovedthanlost.net>2009-02-26 11:43:39 +1100
commit5f73eb553fd083b558fb9553b0c07b6019d0ccee (patch)
tree123ef2a9c7b8aa4e1cd52e6b98d0b3c53d626de6 /lib/puppet/parser
parente40aea3c655e698d26c29370227b52c489e6db2b (diff)
downloadpuppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.tar.gz
puppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.tar.xz
puppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.zip
Fixed #1849 - Ruby 1.9 portability: `when' doesn't like colons, replace with semicolons
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/ast/collexpr.rb12
-rw-r--r--lib/puppet/parser/ast/function.rb4
-rw-r--r--lib/puppet/parser/functions.rb4
-rw-r--r--lib/puppet/parser/functions/defined.rb4
-rw-r--r--lib/puppet/parser/resource/reference.rb4
5 files changed, 14 insertions, 14 deletions
diff --git a/lib/puppet/parser/ast/collexpr.rb b/lib/puppet/parser/ast/collexpr.rb
index baed325cb..6ade58b7e 100644
--- a/lib/puppet/parser/ast/collexpr.rb
+++ b/lib/puppet/parser/ast/collexpr.rb
@@ -28,15 +28,15 @@ class CollExpr < AST::Branch
# case statements as doing an eval here.
code = proc do |resource|
case @oper
- when "and": code1.call(resource) and code2.call(resource)
- when "or": code1.call(resource) or code2.call(resource)
- when "==":
+ when "and"; code1.call(resource) and code2.call(resource)
+ when "or"; code1.call(resource) or code2.call(resource)
+ when "=="
if resource[str1].is_a?(Array) && form != :exported
resource[str1].include?(str2)
else
resource[str1] == str2
end
- when "!=": resource[str1] != str2
+ when "!="; resource[str1] != str2
end
end
@@ -46,12 +46,12 @@ class CollExpr < AST::Branch
end
case @oper
- when "and", "or":
+ when "and", "or"
if form == :exported
raise Puppet::ParseError, "Puppet does not currently support collecting exported resources with more than one condition"
end
oper = @oper.upcase
- when "==": oper = "="
+ when "=="; oper = "="
else
oper = @oper
end
diff --git a/lib/puppet/parser/ast/function.rb b/lib/puppet/parser/ast/function.rb
index fc3797f15..2f768ebdb 100644
--- a/lib/puppet/parser/ast/function.rb
+++ b/lib/puppet/parser/ast/function.rb
@@ -19,12 +19,12 @@ class Puppet::Parser::AST
# Now check that it's been used correctly
case @ftype
- when :rvalue:
+ when :rvalue
unless Puppet::Parser::Functions.rvalue?(@name)
raise Puppet::ParseError, "Function '%s' does not return a value" %
@name
end
- when :statement:
+ when :statement
if Puppet::Parser::Functions.rvalue?(@name)
raise Puppet::ParseError,
"Function '%s' must be the value of a statement" %
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index b9e49131c..0434e9b48 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -113,8 +113,8 @@ module Functions
if @functions.include? name
case @functions[name][:type]
- when :statement: return false
- when :rvalue: return true
+ when :statement; return false
+ when :rvalue; return true
end
else
return false
diff --git a/lib/puppet/parser/functions/defined.rb b/lib/puppet/parser/functions/defined.rb
index 4e369ae48..b25368ccc 100644
--- a/lib/puppet/parser/functions/defined.rb
+++ b/lib/puppet/parser/functions/defined.rb
@@ -8,13 +8,13 @@ Puppet::Parser::Functions::newfunction(:defined, :type => :rvalue, :doc => "Dete
result = false
vals.each do |val|
case val
- when String:
+ when String
# For some reason, it doesn't want me to return from here.
if Puppet::Type.type(val) or finddefine(val) or findclass(val)
result = true
break
end
- when Puppet::Parser::Resource::Reference:
+ when Puppet::Parser::Resource::Reference
if findresource(val.to_s)
result = true
break
diff --git a/lib/puppet/parser/resource/reference.rb b/lib/puppet/parser/resource/reference.rb
index e552b51fe..a37f8400d 100644
--- a/lib/puppet/parser/resource/reference.rb
+++ b/lib/puppet/parser/resource/reference.rb
@@ -33,7 +33,7 @@ class Puppet::Parser::Resource::Reference < Puppet::Resource::Reference
def definedtype
unless defined? @definedtype
case self.type
- when "Class": # look for host classes
+ when "Class" # look for host classes
if self.title == :main
tmp = @scope.findclass("")
else
@@ -41,7 +41,7 @@ class Puppet::Parser::Resource::Reference < Puppet::Resource::Reference
fail Puppet::ParseError, "Could not find class '%s'" % self.title
end
end
- when "Node": # look for node definitions
+ when "Node" # look for node definitions
unless tmp = @scope.parser.nodes[self.title]
fail Puppet::ParseError, "Could not find node '%s'" % self.title
end