Class: Sexp2Ruby::Node::Args
Constant Summary
Constants inherited from Base
Base::ASSIGN_NODES, Base::LF, 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
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sexp2ruby/node/args.rb', line 4 def to_s(exp) args = [] until exp.empty? do arg = exp.shift case arg when Symbol then args << arg when Sexp then case arg.first when :lasgn then args << process(arg) when :masgn then args << process(arg) when :kwarg then _, k, v = arg args << "#{k}: #{process v}" else raise "unknown arg type #{arg.first.inspect}" end else raise "unknown arg type #{arg.inspect}" end end "(#{args.join ', '})" end |