Skip to content

Commit 22cc8ca

Browse files
committed
Nodoc various utility methods
They don't tell much of a story and just pull attention away from actually unique methods
1 parent cf2d1e4 commit 22cc8ca

3 files changed

Lines changed: 23 additions & 25 deletions

File tree

lib/prism/lex_compat.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def initialize(value, comments, magic_comments, data_loc, errors, warnings, sour
2020
end
2121

2222
# Implement the hash pattern matching interface for Result.
23-
def deconstruct_keys(keys)
23+
def deconstruct_keys(keys) # :nodoc:
2424
super.merge!(value: value)
2525
end
2626
end

lib/prism/parse_result.rb

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def chop
350350
end
351351

352352
# Returns a string representation of this location.
353-
def inspect
353+
def inspect # :nodoc:
354354
"#<Prism::Location @start_offset=#{@start_offset} @length=#{@length} start_line=#{start_line}>"
355355
end
356356

@@ -477,12 +477,12 @@ def cached_end_code_units_column(cache)
477477
end
478478

479479
# Implement the hash pattern matching interface for Location.
480-
def deconstruct_keys(keys)
480+
def deconstruct_keys(keys) # :nodoc:
481481
{ start_offset: start_offset, end_offset: end_offset }
482482
end
483483

484484
# Implement the pretty print interface for Location.
485-
def pretty_print(q)
485+
def pretty_print(q) # :nodoc:
486486
q.text("(#{start_line},#{start_column})-(#{end_line},#{end_column})")
487487
end
488488

@@ -528,7 +528,7 @@ def initialize(location)
528528
end
529529

530530
# Implement the hash pattern matching interface for Comment.
531-
def deconstruct_keys(keys)
531+
def deconstruct_keys(keys) # :nodoc:
532532
{ location: location }
533533
end
534534

@@ -548,7 +548,7 @@ def trailing?
548548
end
549549

550550
# Returns a string representation of this comment.
551-
def inspect
551+
def inspect # :nodoc:
552552
"#<Prism::InlineComment @location=#{location.inspect}>"
553553
end
554554
end
@@ -562,7 +562,7 @@ def trailing?
562562
end
563563

564564
# Returns a string representation of this comment.
565-
def inspect
565+
def inspect # :nodoc:
566566
"#<Prism::EmbDocComment @location=#{location.inspect}>"
567567
end
568568
end
@@ -592,12 +592,12 @@ def value
592592
end
593593

594594
# Implement the hash pattern matching interface for MagicComment.
595-
def deconstruct_keys(keys)
595+
def deconstruct_keys(keys) # :nodoc:
596596
{ key_loc: key_loc, value_loc: value_loc }
597597
end
598598

599599
# Returns a string representation of this magic comment.
600-
def inspect
600+
def inspect # :nodoc:
601601
"#<Prism::MagicComment @key=#{key.inspect} @value=#{value.inspect}>"
602602
end
603603
end
@@ -626,12 +626,12 @@ def initialize(type, message, location, level)
626626
end
627627

628628
# Implement the hash pattern matching interface for ParseError.
629-
def deconstruct_keys(keys)
629+
def deconstruct_keys(keys) # :nodoc:
630630
{ type: type, message: message, location: location, level: level }
631631
end
632632

633633
# Returns a string representation of this error.
634-
def inspect
634+
def inspect # :nodoc:
635635
"#<Prism::ParseError @type=#{@type.inspect} @message=#{@message.inspect} @location=#{@location.inspect} @level=#{@level.inspect}>"
636636
end
637637
end
@@ -660,12 +660,12 @@ def initialize(type, message, location, level)
660660
end
661661

662662
# Implement the hash pattern matching interface for ParseWarning.
663-
def deconstruct_keys(keys)
663+
def deconstruct_keys(keys) # :nodoc:
664664
{ type: type, message: message, location: location, level: level }
665665
end
666666

667667
# Returns a string representation of this warning.
668-
def inspect
668+
def inspect # :nodoc:
669669
"#<Prism::ParseWarning @type=#{@type.inspect} @message=#{@message.inspect} @location=#{@location.inspect} @level=#{@level.inspect}>"
670670
end
671671
end
@@ -705,7 +705,7 @@ def initialize(comments, magic_comments, data_loc, errors, warnings, source)
705705
end
706706

707707
# Implement the hash pattern matching interface for Result.
708-
def deconstruct_keys(keys)
708+
def deconstruct_keys(keys) # :nodoc:
709709
{ comments: comments, magic_comments: magic_comments, data_loc: data_loc, errors: errors, warnings: warnings }
710710
end
711711

@@ -752,7 +752,7 @@ def initialize(value, comments, magic_comments, data_loc, errors, warnings, sour
752752
end
753753

754754
# Implement the hash pattern matching interface for ParseResult.
755-
def deconstruct_keys(keys)
755+
def deconstruct_keys(keys) # :nodoc:
756756
super.merge!(value: value)
757757
end
758758

@@ -786,7 +786,7 @@ def initialize(value, comments, magic_comments, data_loc, errors, warnings, sour
786786
end
787787

788788
# Implement the hash pattern matching interface for LexResult.
789-
def deconstruct_keys(keys)
789+
def deconstruct_keys(keys) # :nodoc:
790790
super.merge!(value: value)
791791
end
792792
end
@@ -804,7 +804,7 @@ def initialize(value, comments, magic_comments, data_loc, errors, warnings, sour
804804
end
805805

806806
# Implement the hash pattern matching interface for ParseLexResult.
807-
def deconstruct_keys(keys)
807+
def deconstruct_keys(keys) # :nodoc:
808808
super.merge!(value: value)
809809
end
810810
end
@@ -830,7 +830,7 @@ def initialize(source, type, value, location)
830830
end
831831

832832
# Implement the hash pattern matching interface for Token.
833-
def deconstruct_keys(keys)
833+
def deconstruct_keys(keys) # :nodoc:
834834
{ type: type, value: value, location: location }
835835
end
836836

@@ -842,7 +842,7 @@ def location
842842
end
843843

844844
# Implement the pretty print interface for Token.
845-
def pretty_print(q)
845+
def pretty_print(q) # :nodoc:
846846
q.group do
847847
q.text(type.to_s)
848848
self.location.pretty_print(q)
@@ -864,7 +864,7 @@ def ==(other)
864864
end
865865

866866
# Returns a string representation of this token.
867-
def inspect
867+
def inspect # :nodoc:
868868
location
869869
super
870870
end

templates/lib/prism/node.rb.erb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ module Prism
161161

162162
# Similar to inspect, but respects the current level of indentation given by
163163
# the pretty print object.
164-
def pretty_print(q)
164+
def pretty_print(q) # :nodoc:
165165
q.seplist(inspect.chomp.each_line, -> { q.breakable }) do |line|
166166
q.text(line.chomp)
167167
end
@@ -409,8 +409,7 @@ module Prism
409409
# def deconstruct: () -> Array[Node?]
410410
alias deconstruct child_nodes
411411

412-
# def deconstruct_keys: (Array[Symbol] keys) -> { <%= (["node_id: Integer", "location: Location"] + node.fields.map { |field| "#{field.name}: #{field.rbs_class}" }).join(", ") %> }
413-
def deconstruct_keys(keys)
412+
def deconstruct_keys(keys) # :nodoc:
414413
{ <%= (["node_id: node_id", "location: location"] + node.fields.map { |field| "#{field.name}: #{field.name}" }).join(", ") %> }
415414
end
416415
<%- if (node_flags = node.flags) -%>
@@ -487,8 +486,7 @@ module Prism
487486
<%- end -%>
488487
<%- end -%>
489488

490-
# def inspect -> String
491-
def inspect
489+
def inspect # :nodoc:
492490
InspectVisitor.compose(self)
493491
end
494492

0 commit comments

Comments
 (0)