Skip to content

Commit

Permalink
Truncate GrammarFile's @text when inspecting
Browse files Browse the repository at this point in the history
  • Loading branch information
junk0612 committed Apr 5, 2024
1 parent 80fd926 commit dc3648a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/lrama/lexer/grammar_file.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
module Lrama
class Lexer
class GrammarFile
class Text < String
def inspect
length <= 50 ? super : "#{self[0..47]}...".inspect
end
end

attr_reader :path, :text

def initialize(path, text)
@path = path
@text = text.freeze
@text = Text.new(text).freeze
end

def ==(other)
Expand Down

0 comments on commit dc3648a

Please sign in to comment.