File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -172,12 +172,7 @@ def proc_fields_for(parent, nesting)
172172 end
173173
174174 def source_for ( proc , nesting )
175- ast = if defined? ( Prism )
176- Prism ::Translation ::ParserCurrent . parse ( proc . source )
177- else
178- Parser ::CurrentRuby . parse ( proc . source )
179- end
180- lambdas = exctract_lambdas ( ast )
175+ lambdas = exctract_lambdas ( ast_from_proc ( proc ) )
181176
182177 raise "No lambdas found, try to reformat your code:\n `#{ proc . source } `" unless lambdas
183178
@@ -204,6 +199,14 @@ def source_for(proc, nesting)
204199 Unparser . unparse ( source )
205200 end
206201
202+ def ast_from_proc ( proc )
203+ if defined? ( Prism )
204+ Prism ::Translation ::ParserCurrent . parse ( proc . source )
205+ else
206+ Parser ::CurrentRuby . parse ( proc . source )
207+ end
208+ end
209+
207210 def exctract_lambdas ( node )
208211 return unless node . is_a? ( Parser ::AST ::Node )
209212
You can’t perform that action at this time.
0 commit comments