class RedParse::ListInNode::StringCatNode
Public Class Methods
new(*strses)
click to toggle source
Calls superclass method
RedParse::ListInNode::Node::new
# File lib/redparse/node.rb, line 1641 def initialize(*strses) strs=strses.pop.unshift( *strses ) hd=strs.shift if HereDocNode===strs.first strs.map!{|str| StringNode.new(str)} strs.unshift hd if hd super( *strs ) end
Public Instance Methods
parsetree(o)
click to toggle source
# File lib/redparse/node.rb, line 1648 def parsetree(o) result=map{|str| str.parsetree(o)} sum='' type=:str tree=i=nil result.each_with_index{|tree2,i2| tree,i=tree2,i2 sum+=tree[1] tree.first==:str or break(type=:dstr) } [type,sum,*tree[2..-1]+result[i+1..-1].inject([]){|cat,x| if x.first==:dstr x.shift x0=x[0] if x0=='' and x.size==2 x.shift else x[0]=[:str,x0] end cat+x elsif x.last.empty? cat else cat+[x] end } ] end
unparse(o=default_unparse_options)
click to toggle source
# File lib/redparse/node.rb, line 1676 def unparse o=default_unparse_options map{|ss| ss.unparse(o)}.join ' ' end