Class: Sexp2Ruby::Node::Begin
Overview
TODO: figure out how to do rescue and ensure ENTIRELY w/o begin
Constant Summary
Constants inherited from Base
Sexp2Ruby::Node::Base::ASSIGN_NODES, Sexp2Ruby::Node::Base::LF, Sexp2Ruby::Node::Base::LINE_LENGTH
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Sexp2Ruby::Node::Base
Instance Method Details
#to_s(exp) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sexp2ruby/node/begin.rb', line 6 def to_s(exp) code = [] code << "begin" until exp.empty? src = process(exp.shift) src = indent(src) unless src =~ /(^|\n)(rescue|ensure)/ # ensure no level 0 rescues code << src end code << "end" code.join(LF) end |