Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/react/object.rb,
lib/reactrb/auto-import.rb,
lib/react/rendering_context.rb
Overview
modifies const and method_missing so that they will attempt to auto import native libraries and components using React::NativeLibrary
Class Method Summary collapse
- ._reactrb_original_const_missing ⇒ Object
- ._reactrb_original_method_missing ⇒ Object
- ._reactrb_tag_original_const_missing ⇒ Object
- .const_missing(const_name) ⇒ Object
- .method_missing(method_name, *args, &block) ⇒ Object
Instance Method Summary collapse
Class Method Details
._reactrb_original_const_missing ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/reactrb/auto-import.rb', line 9 def const_missing(const_name) # Opal uses const_missing to initially define things, # so we always call the original, and respond to the exception _reactrb_tag_original_const_missing(const_name) rescue StandardError => e React::Component::Tags.html_tag_class_for(const_name) || raise(e) end |
._reactrb_original_method_missing ⇒ Object
10 |
# File 'lib/reactrb/auto-import.rb', line 10 alias _reactrb_original_method_missing method_missing |
._reactrb_tag_original_const_missing ⇒ Object
5 |
# File 'lib/react/object.rb', line 5 alias _reactrb_tag_original_const_missing const_missing |
.const_missing(const_name) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/react/object.rb', line 7 def const_missing(const_name) # Opal uses const_missing to initially define things, # so we always call the original, and respond to the exception _reactrb_tag_original_const_missing(const_name) rescue StandardError => e React::Component::Tags.html_tag_class_for(const_name) || raise(e) end |
.method_missing(method_name, *args, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/reactrb/auto-import.rb', line 20 def method_missing(method_name, *args, &block) method = method_name.gsub(/_as_node/, '') # remove once _as_node is deprecated. component_class = React::NativeLibrary.import_const_from_native(self, method, false) _reactrb_original_method_missing(method, *args, &block) unless component_class if method == method_name React::RenderingContext.render(component_class, *args, &block) else # remove once _as_node is deprecated. React::RenderingContext.build_only(component_class, *args, &block) end end |
Instance Method Details
#br ⇒ Object
134 135 136 137 138 139 140 |
# File 'lib/react/rendering_context.rb', line 134 def br return send(:br) if is_a? React::Component React::RenderingContext.render(:span) do React::RenderingContext.render(to_s) React::RenderingContext.render(:br) end end |