summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/leaf.rb
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-07-18 13:08:57 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-07-25 20:13:58 +1000
commite3ee594fdfa0e7a6d9de26c4307e217de866f462 (patch)
tree315177df89205b1747fb506edc543175ebf032f0 /lib/puppet/parser/ast/leaf.rb
parentb3b76dffdd9cd8ed5c3d0230624bf05015bec5b8 (diff)
downloadpuppet-e3ee594fdfa0e7a6d9de26c4307e217de866f462.tar.gz
puppet-e3ee594fdfa0e7a6d9de26c4307e217de866f462.tar.xz
puppet-e3ee594fdfa0e7a6d9de26c4307e217de866f462.zip
Fix #2422 & #2433 - make sure puppetdoc transform AST::Leaf boolean correctly
AST nodes don't have a valid to_s that is producing a correct representation of said node. This patch adds some of the AST node to_s to produce correct values that can be used verbatim by puppetdoc to render the documentation. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/parser/ast/leaf.rb')
-rw-r--r--lib/puppet/parser/ast/leaf.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb
index dba9812a7..d08938011 100644
--- a/lib/puppet/parser/ast/leaf.rb
+++ b/lib/puppet/parser/ast/leaf.rb
@@ -11,7 +11,7 @@ class Puppet::Parser::AST
end
def to_s
- return @value
+ return @value.to_s unless @value.nil?
end
end
@@ -29,6 +29,10 @@ class Puppet::Parser::AST
end
@value
end
+
+ def to_s
+ @value ? "true" : "false"
+ end
end
# The base string class.
@@ -38,6 +42,10 @@ class Puppet::Parser::AST
def evaluate(scope)
return scope.strinterp(@value, file, line)
end
+
+ def to_s
+ "\"#{@value}\""
+ end
end
# An uninterpreted string.
@@ -45,6 +53,10 @@ class Puppet::Parser::AST
def evaluate(scope)
return @value
end
+
+ def to_s
+ "\"#{@value}\""
+ end
end
# The 'default' option on case statements and selectors.