1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Define Ripper::Lexer::Elem#to_s

Alias `#inspect` as `#to_s` also in the new `Ripper::Lexer::Elem`
class, so that `puts Ripper::Lexer.new(code).scan` shows the
attributes.
This commit is contained in:
Nobuyoshi Nakada 2021-12-02 18:29:45 +09:00
parent 39f2b4f1a4
commit 524a808d23
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -119,6 +119,8 @@ class Ripper
"#<#{self.class}: #{event}@#{pos[0]}:#{pos[1]}:#{state}: #{tok.inspect}#{": " if message}#{message}>"
end
alias to_s inspect
def pretty_print(q)
q.group(2, "#<#{self.class}:", ">") {
q.breakable