Last active
November 25, 2017 11:10
-
-
Save lucasluitjes/7c2f7edb7e511c602b3762c5b232e7d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb> require 'parser/current' | |
irb> require 'rexml/document' | |
irb> snippet = 'f.text_field :attr, placeholder: "placeholder text"' | |
irb> exp = Parser::CurrentRuby.parse(snippet) | |
irb> xml = XMLAST.new(exp) | |
irb> xml.doc.write(STDOUT, 2) | |
<root> | |
<send> | |
<send> | |
<nilclass-val /> | |
<symbol-val /> | |
</send> | |
<symbol-val /> | |
<sym> | |
<symbol-val /> | |
</sym> | |
<hash> | |
<pair> | |
<sym> | |
<symbol-val /> | |
</sym> | |
<str> | |
<string-val /> | |
</str> | |
</pair> | |
</hash> | |
</send> | |
</root> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment