method
on_heredoc_dedent
v2_4_6 -
Show latest stable
- Class:
Ripper::Lexer
on_heredoc_dedent(v, w)private
No documentation available.
# File ext/ripper/lib/ripper/lexer.rb, line 68
def on_heredoc_dedent(v, w)
ignored_sp = []
heredoc = @buf.last
heredoc.each_with_index do |e, i|
if Elem === e and e.event == :on_tstring_content
tok = e.tok.dup if w > 0 and /\A\s/ =~ e.tok
if (n = dedent_string(e.tok, w)) > 0
ignored_sp << [i, Elem.new(e.pos.dup, :on_ignored_sp, tok[0, n])]
e.pos[1] += n
end
end
end
ignored_sp.reverse_each do |i, e|
heredoc[i, 0] = [e]
end
v
end