@@ -761,7 +761,7 @@ def format(q)
761761 if part . is_a? ( StringLiteral )
762762 q . format ( part . parts . first )
763763 else
764- q . text ( part . value [ 1 ..- 1 ] )
764+ q . text ( part . value [ 1 ..] )
765765 end
766766 end
767767 end
@@ -1190,7 +1190,7 @@ def deconstruct_keys(keys)
11901190 end
11911191
11921192 def format ( q )
1193- if value & .is_a? ( HashLiteral )
1193+ if value . is_a? ( HashLiteral )
11941194 format_contents ( q )
11951195 else
11961196 q . group { format_contents ( q ) }
@@ -2301,7 +2301,7 @@ def format(q)
23012301
23022302 # First, walk down the chain until we get to the point where we're not
23032303 # longer at a chainable node.
2304- while true
2304+ loop do
23052305 case children . last
23062306 in Call [ receiver : Call ]
23072307 children << children . last . receiver
@@ -3079,7 +3079,7 @@ def trailing?
30793079 end
30803080
30813081 def ignore?
3082- value [ 1 ..- 1 ] . strip == "stree-ignore"
3082+ value [ 1 ..] . strip == "stree-ignore"
30833083 end
30843084
30853085 def comments
@@ -3917,7 +3917,7 @@ def quotes(q)
39173917 end
39183918 elsif Quotes . locked? ( self )
39193919 if quote . start_with? ( ":" )
3920- [ hash_key ? quote [ 1 ..- 1 ] : quote , quote [ 1 ..- 1 ] ]
3920+ [ hash_key ? quote [ 1 ..] : quote , quote [ 1 ..] ]
39213921 else
39223922 [ hash_key ? quote : ":#{ quote } " , quote ]
39233923 end
@@ -4967,7 +4967,7 @@ def format(q)
49674967
49684968 # The list of nodes that represent patterns inside of pattern matching so that
49694969 # when a pattern is being printed it knows if it's nested.
4970- PATTERNS = [ AryPtn , Binary , FndPtn , HshPtn , RAssign ]
4970+ PATTERNS = [ AryPtn , Binary , FndPtn , HshPtn , RAssign ] . freeze
49714971
49724972 # Ident represents an identifier anywhere in code. It can represent a very
49734973 # large number of things, depending on where it is in the syntax tree.
@@ -5587,7 +5587,7 @@ def format(q)
55875587 # the values, then we're going to insert them every 3 characters
55885588 # starting from the right.
55895589 index = ( value . length + 2 ) % 3
5590- q . text ( " #{ value } " [ index ..- 1 ] . scan ( /.../ ) . join ( "_" ) . strip )
5590+ q . text ( " #{ value } " [ index ..] . scan ( /.../ ) . join ( "_" ) . strip )
55915591 else
55925592 q . text ( value )
55935593 end
@@ -6475,7 +6475,7 @@ def skip_indent?
64756475 # This approach maintains the nice conciseness of the inline version, while
64766476 # keeping the correct semantic meaning.
64776477 module Parentheses
6478- NODES = [ Args , Assign , Assoc , Binary , Call , Defined , MAssign , OpAssign ]
6478+ NODES = [ Args , Assign , Assoc , Binary , Call , Defined , MAssign , OpAssign ] . freeze
64796479
64806480 def self . flat ( q )
64816481 return yield unless NODES . include? ( q . parent . class )
@@ -6686,7 +6686,7 @@ def format(q)
66866686
66876687 contents = -> do
66886688 q . seplist ( parts ) { |part | q . format ( part ) }
6689- q . format ( rest ) if rest && rest . is_a? ( ExcessedComma )
6689+ q . format ( rest ) if rest & .is_a? ( ExcessedComma )
66906690 end
66916691
66926692 if ![ Def , Defs , DefEndless ] . include? ( q . parent . class ) || parts . empty?
@@ -7323,14 +7323,14 @@ def format(q)
73237323 end
73247324
73257325 q . text ( "}" )
7326- q . text ( ending [ 1 ..- 1 ] )
7326+ q . text ( ending [ 1 ..] )
73277327 end
73287328 else
73297329 q . group do
73307330 q . text ( "/" )
73317331 q . format_each ( parts )
73327332 q . text ( "/" )
7333- q . text ( ending [ 1 ..- 1 ] )
7333+ q . text ( ending [ 1 ..] )
73347334 end
73357335 end
73367336 end
0 commit comments