Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit c97fd4d

Browse files
committed
ActiveSupport has invented this wheel
1 parent 1277e8e commit c97fd4d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/react/component.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,7 @@ def p(*args, &block)
184184

185185
def component?(name)
186186
name_list = name.split("::")
187-
scope_list = self.class.name.split("::").inject([Module]) do |nesting, next_const|
188-
nesting + [nesting.last.const_get(next_const)]
189-
end.reverse
190-
scope_list.each do |scope|
187+
[self.class, *self.class.parents].each do |scope|
191188
component = name_list.inject(scope) do |scope, class_name|
192189
scope.const_get(class_name)
193190
end rescue nil

0 commit comments

Comments
 (0)