class Unparser::Writer::Regexp::Effective
def dispatch
def dispatch buffer.root_indent do write(token_open) body.each(&method(:emit_body)) write(token_close) emit_options end end
def emit_body(node)
def emit_body(node) if n_begin?(node) write('#{') node.children.each(&method(:visit)) write('}') elsif n_gvar?(node) write('#') write_regular(node.children.first.to_s) else write_regular(node.children.first) end end
def emit_options
def emit_options write(children.last.children.join) end
def write_regular(string)
def write_regular(string) if string.length > 1 && string.start_with?("\n") string.each_char do |char| buffer.append_without_prefix(char.eql?("\n") ? '\c*' : char) end else buffer.append_without_prefix(string) end end