@@ -13,7 +13,7 @@ module React
1313 module Component
1414 def self . included ( base )
1515 base . include ( API )
16- base . include ( React :: Callbacks )
16+ base . include ( Callbacks )
1717 base . class_eval do
1818 class_attribute :initial_state
1919 define_callback :before_mount
@@ -86,7 +86,7 @@ def method_missing(n, *args, &block)
8686 unless name && name . method_defined? ( :render )
8787 return super
8888 end
89- React :: RenderingContext . build_or_render ( node_only , name , *args , &block )
89+ RenderingContext . build_or_render ( node_only , name , *args , &block )
9090 end
9191
9292 end
@@ -131,16 +131,16 @@ def component_will_mount
131131 IsomorphicHelpers . load_context ( true ) if IsomorphicHelpers . on_opal_client?
132132 @props_wrapper = self . class . props_wrapper . new ( Hash . new ( `#{ @native } .props` ) )
133133 set_state! initial_state if initial_state
134- React :: State . initialize_states ( self , initial_state )
135- React :: State . set_state_context_to ( self ) { self . run_callback ( :before_mount ) }
134+ State . initialize_states ( self , initial_state )
135+ State . set_state_context_to ( self ) { self . run_callback ( :before_mount ) }
136136 rescue Exception => e
137137 self . class . process_exception ( e , self )
138138 end
139139
140140 def component_did_mount
141- React :: State . set_state_context_to ( self ) do
141+ State . set_state_context_to ( self ) do
142142 self . run_callback ( :after_mount )
143- React :: State . update_states_to_observe
143+ State . update_states_to_observe
144144 end
145145 rescue Exception => e
146146 self . class . process_exception ( e , self )
@@ -149,7 +149,7 @@ def component_did_mount
149149 def component_will_receive_props ( next_props )
150150 # need to rethink how this works in opal-react, or if its actually that useful within the react.rb environment
151151 # for now we are just using it to clear processed_params
152- React :: State . set_state_context_to ( self ) { self . run_callback ( :before_receive_props , Hash . new ( next_props ) ) }
152+ State . set_state_context_to ( self ) { self . run_callback ( :before_receive_props , Hash . new ( next_props ) ) }
153153 rescue Exception => e
154154 self . class . process_exception ( e , self )
155155 end
@@ -160,7 +160,7 @@ def props_changed?(next_props)
160160 end
161161
162162 def should_component_update? ( next_props , next_state )
163- React :: State . set_state_context_to ( self ) do
163+ State . set_state_context_to ( self ) do
164164 next_props = Hash . new ( next_props )
165165 if self . respond_to? ( :needs_update? )
166166 !!self . needs_update? ( next_props , Hash . new ( next_state ) )
@@ -181,25 +181,25 @@ def should_component_update?(next_props, next_state)
181181 end
182182
183183 def component_will_update ( next_props , next_state )
184- React :: State . set_state_context_to ( self ) { self . run_callback ( :before_update , Hash . new ( next_props ) , Hash . new ( next_state ) ) }
184+ State . set_state_context_to ( self ) { self . run_callback ( :before_update , Hash . new ( next_props ) , Hash . new ( next_state ) ) }
185185 @props_wrapper = self . class . props_wrapper . new ( Hash . new ( next_props ) )
186186 rescue Exception => e
187187 self . class . process_exception ( e , self )
188188 end
189189
190190 def component_did_update ( prev_props , prev_state )
191- React :: State . set_state_context_to ( self ) do
191+ State . set_state_context_to ( self ) do
192192 self . run_callback ( :after_update , Hash . new ( prev_props ) , Hash . new ( prev_state ) )
193- React :: State . update_states_to_observe
193+ State . update_states_to_observe
194194 end
195195 rescue Exception => e
196196 self . class . process_exception ( e , self )
197197 end
198198
199199 def component_will_unmount
200- React :: State . set_state_context_to ( self ) do
200+ State . set_state_context_to ( self ) do
201201 self . run_callback ( :before_unmount )
202- React :: State . remove
202+ State . remove
203203 end
204204 rescue Exception => e
205205 self . class . process_exception ( e , self )
@@ -232,7 +232,7 @@ def method_missing(n, *args, &block)
232232 node_only = true
233233 name = name . gsub ( /_as_node$/ , "" )
234234 end
235- unless ( React :: HTML_TAGS . include? ( name ) || name == 'present' || name == '_p_tag' || ( name = component? ( name , self ) ) )
235+ unless ( HTML_TAGS . include? ( name ) || name == 'present' || name == '_p_tag' || ( name = component? ( name , self ) ) )
236236 return super
237237 end
238238
@@ -244,21 +244,21 @@ def method_missing(n, *args, &block)
244244 name = "p"
245245 end
246246
247- React :: RenderingContext . build_or_render ( node_only , name , *args , &block )
247+ RenderingContext . build_or_render ( node_only , name , *args , &block )
248248 end
249249
250250 def watch ( value , &on_change )
251- React :: Observable . new ( value , on_change )
251+ Observable . new ( value , on_change )
252252 end
253253
254254 def define_state ( *args , &block )
255- React :: State . initialize_states ( self , self . class . define_state ( *args , &block ) )
255+ State . initialize_states ( self , self . class . define_state ( *args , &block ) )
256256 end
257257
258258 attr_reader :waiting_on_resources
259259
260260 def _render_wrapper
261- React :: State . set_state_context_to ( self ) do
261+ State . set_state_context_to ( self ) do
262262 RenderingContext . render ( nil ) { render || "" } . tap { |element | @waiting_on_resources = element . waiting_on_resources if element . respond_to? :waiting_on_resources }
263263 end
264264 rescue Exception => e
0 commit comments