Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 61ab5bd

Browse files
committed
Refactor: reduce number of to_sym calls.
1 parent 39436cb commit 61ab5bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/rspec/core/example.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,15 @@ class Procsy
262262
attr_reader :example
263263

264264
Example.public_instance_methods(false).each do |name|
265-
next if name.to_sym == :run || name.to_sym == :inspect || name.to_sym == :to_s
265+
name_sym = name.to_sym
266+
next if name_sym == :run || name_sym == :inspect || name_sym == :to_s
266267

267268
define_method(name) { |*a, &b| @example.__send__(name, *a, &b) }
268269
end
269270

270271
Proc.public_instance_methods(false).each do |name|
271-
next if name.to_sym == :call || name.to_sym == :inspect || name.to_sym == :to_s || name.to_sym == :to_proc
272+
name_sym = name.to_sym
273+
next if name_sym == :call || name_sym == :inspect || name_sym == :to_s || name_sym == :to_proc
272274

273275
define_method(name) { |*a, &b| @proc.__send__(name, *a, &b) }
274276
end

0 commit comments

Comments
 (0)