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:
parent
39f2b4f1a4
commit
524a808d23
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue