class Object
Lazy load HTML tag constants in the form DIV or A This is needed to allow for a HAML expression like this DIV.my_class
modifies const and method_missing
so that they will attempt to auto import native libraries and components using React::NativeLibrary
Constants
- APP_PATH
Public Class Methods
[](selector)
click to toggle source
# File lib/react/top_level.rb, line 117 def self.[](selector) find(selector) end
const_missing(const_name)
click to toggle source
# 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
Also aliased as: _reactrb_tag_original_const_missing, _reactrb_original_const_missing
find(selector)
click to toggle source
# File lib/react/top_level.rb, line 108 def self.find(selector) selector = begin selector.dom_node rescue selector end if `#{selector}.$dom_node !== undefined` `$(#{selector})` end
method_missing(method_name, *args, &block)
click to toggle source
# 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
Also aliased as: _reactrb_original_method_missing
Public Instance Methods
br()
click to toggle source
# 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
para(*args, &block)
click to toggle source
# File lib/react/rendering_context.rb, line 128 def para(*args, &block) args.unshift(:p) return send(*args, &block) if is_a? React::Component React::RenderingContext.render(*args) { to_s } end