Skip to content

Instantly share code, notes, and snippets.

@michaelfeathers
Created February 26, 2013 17:55
Show Gist options
  • Save michaelfeathers/5040541 to your computer and use it in GitHub Desktop.
Save michaelfeathers/5040541 to your computer and use it in GitHub Desktop.
FIELDS_TEXT = "class A; def a; @a = @b; end; end"
FIELDS_SEXP = Ripper.sexp(FIELDS_TEXT)
[:program, [[:class, [:const_ref, [:@const, "A", [1, 6]]], nil,
[:bodystmt, [[:def, [:@ident, "a", [1, 13]], [:params, nil, nil, nil, nil, nil],
[:bodystmt, [[:assign, [:var_field, [:@ivar, "@a", [1, 16]]],
[:var_ref, [:@ivar, "@b", [1, 21]]]]], nil, nil, nil]]], nil, nil, nil]]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment