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

Commit b9d104c

Browse files
committed
fix
1 parent ffd0699 commit b9d104c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/reactive-ruby/isomorphic_helpers.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ def initialize(unique_id, ctx = nil, controller = nil, name = nil)
114114
if RUBY_ENGINE != 'opal'
115115
@controller = controller
116116
@ctx = ctx
117-
@@ctx_methods.each do |method_name, block|
118-
@ctx.attach("ServerSideIsomorphicMethod.#{method_name}", block)
117+
if defined? @@ctx_methods
118+
@@ctx_methods.each do |method_name, block|
119+
@ctx.attach("ServerSideIsomorphicMethod.#{method_name}", block)
120+
end
119121
end
120122
send_to_opal(:load_context, @unique_id, name)
121123
end
@@ -127,11 +129,11 @@ def eval(js)
127129
@ctx.eval(js) if @ctx
128130
end
129131

130-
def send_to_opal(method, *args)
132+
def send_to_opal(method_name, *args)
131133
return unless @ctx
132134
args = [1] if args.length == 0
133135
::ReactiveRuby::ComponentLoader.new(@ctx).load!
134-
@ctx.eval("Opal.React.$const_get('IsomorphicHelpers').$#{method}(#{args.collect { |arg| "'#{arg}'"}.join(', ')})")
136+
@ctx.eval("Opal.React.$const_get('IsomorphicHelpers').$#{method_name}(#{args.collect { |arg| "'#{arg}'"}.join(', ')})")
135137
end
136138

137139
def self.register_before_first_mount_block(&block)

0 commit comments

Comments
 (0)