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

Commit 1277e8e

Browse files
committed
let ActiveSupport do the parent nesting work
1 parent 7c11634 commit 1277e8e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/react/component.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require 'react/ext/string'
22
require 'react/ext/hash'
33
require 'active_support/core_ext/class/attribute'
4+
require 'active_support/core_ext/module/introspection'
45
require 'react/callbacks'
56
require 'react/children'
67
require 'react/rendering_context'
@@ -28,11 +29,7 @@ def self.included(base)
2829
base.extend(ClassMethods)
2930

3031
if base.name
31-
parent = base.name.split("::").inject([Module]) { |nesting, next_const|
32-
nesting + [nesting.last.const_get(next_const)]
33-
}[-2]
34-
35-
class << parent
32+
class << base.parent
3633
def method_missing(n, *args, &block)
3734
name = n
3835
if name =~ /_as_node$/

0 commit comments

Comments
 (0)