Skip to content

Commit 4fe39b6

Browse files
authored
Merge pull request #1453 from kk-ds-000/perf/avoid-string-allocations
Avoid string allocations when generating object name
2 parents 0a55093 + 15c8b88 commit 4fe39b6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/yard/code_objects/base.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,10 @@ def docstring=(comments)
434434
#
435435
# @return [Symbol] the type of code object this represents
436436
def type
437-
self.class.name.split('::').last.gsub(/Object$/, '').downcase.to_sym
437+
obj_name = self.class.name.split('::').last
438+
obj_name.gsub!(/Object$/, '')
439+
obj_name.downcase!
440+
obj_name.to_sym
438441
end
439442

440443
# Represents the unique path of the object. The default implementation

0 commit comments

Comments
 (0)