method
node_text
v1_9_1_378 -
Show latest stable
- Class:
YAML::BaseEmitter
node_text( value, block = nil )public
Emit plain, normal flowing text
# File lib/yaml/baseemitter.rb, line 34
def node_text( value, block = nil )
@seq_map = false
valx = value.dup
unless block
block =
if options(:UseBlock)
'|'
elsif not options(:UseFold) and valx =~ /\n[ \t]/ and not valx =~ /#{YAML::ESCAPE_CHAR}/
'|'
else
'>'
end
indt = $&.to_i if block =~ /\d+/
if valx =~ /(\A\n*[ \t#]|^---\s+)/
indt = options(:Indent) unless indt.to_i > 0
block += indt.to_s
end
block +=
if valx =~ /\n\Z\n/
"+"
elsif valx =~ /\Z\n/
""
else
"-"
end
end
block += "\n"
if block[0] == ""
esc_skip = ( "\t\n" unless valx =~ /^[ \t]/ ) || ""
valx = fold( YAML::escape( valx, esc_skip ) + "\"" ).chomp
self << '"' + indent_text( valx, indt, false )
else
if block[0] == >>
valx = fold( valx )
end
#p [block, indt]
self << block + indent_text( valx, indt )
end
end Related methods
- Instance methods
- binary_base64
- double
- fold
- indent
- indent!
- indent_text
- map
- node_text
- options
- options=
- seq
- seq_map_shortcut
- simple
- single