Skip to content

Commit 6e174fe

Browse files
committed
Fix README parse_with_comments examples
I was playing with comments-preserving unparsing and it seems like README examples uses invalid API BTW is there a reason there's no direct `Unparser.parse_with_comments` method?
1 parent 6c6a242 commit 6e174fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ To preserve the comments from the source:
4444
require 'parser/current'
4545
require 'unparser'
4646

47-
ast, comments = Unparser.parse_with_comments('your(ruby(code)) # with comments')
47+
ast, comments = Unparser.parser.parse_with_comments(Unparser.buffer('your(ruby(code)) # with comments'))
4848

49-
Unparser.unparse(ast, comments) # => 'your(ruby(code)) # with comments'
49+
Unparser.unparse(ast, comments: comments) # => 'your(ruby(code)) # with comments'
5050
```
5151

5252
Passing in manually constructed AST:

0 commit comments

Comments
 (0)