Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/react/object.rb,
lib/react/to_key.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, *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, *args, &block) ⇒ Object
20 21 22 23 24 |
# File 'lib/reactrb/auto-import.rb', line 20 def method_missing(method, *args, &block) component_class = React::NativeLibrary.import_const_from_native(self, method, false) _reactrb_original_method_missing(method, *args, &block) unless component_class React::RenderingContext.render(component_class, *args, &block) end |
Instance Method Details
#br ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/react/rendering_context.rb', line 142 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) ⇒ Object
136 137 138 139 140 |
# File 'lib/react/rendering_context.rb', line 136 def para(*args, &block) args.unshift(:p) return send(*args, &block) if is_a? React::Component React::RenderingContext.render(*args) { to_s } end |
#to_key ⇒ Object
9 10 11 |
# File 'lib/react/to_key.rb', line 9 def to_key object_id end |