Commit cb86015
committed
Fix Style/ItAssignment cop
The `response_handler` method in `lib/hawk/http.rb` previously used the
variable name `it` to store request information for error messages.
Ruby 3.4 introduces a new special variable `it` for single-line blocks.
Using `it` as a local variable can now cause confusion or unexpected
behavior, especially as Ruby evolves. The new RuboCop Style/ItAssignment
cop enforces this best practice.
This commit renames the local variable `it` for clarity and future
compatibility. No functional changes.
Additionally, use interpolation instead of array join for performance
```
Comparison (IPS):
interpolation: 6610794.3 i/s
join: 6103137.6 i/s - 1.08x (± 0.00) slower
Comparison (Memory):
interpolation: 80 allocated
join: 120 allocated - 1.50x more
```
See: https://www.ruby-lang.org/en/news/2024/12/25/ruby-3-4-0-released/1 parent 99cc5bf commit cb86015
1 file changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
0 commit comments