Class: JetUi::Builder
- Inherits:
-
Object
- Object
- JetUi::Builder
- Defined in:
- app/helpers/jet_ui_helper.rb
Instance Method Summary collapse
-
#initialize(view_context) ⇒ Builder
constructor
A new instance of Builder.
- #method_missing(name, *args, **kwargs, &block) ⇒ Object
- #respond_to_missing?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(view_context) ⇒ Builder
Returns a new instance of Builder.
11 12 13 |
# File 'app/helpers/jet_ui_helper.rb', line 11 def initialize(view_context) @view = view_context end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object
15 16 17 18 19 20 |
# File 'app/helpers/jet_ui_helper.rb', line 15 def method_missing(name, *args, **kwargs, &block) component_class = resolve_component(name) content = args.shift if args.first.is_a?(String) instance = component_class.new(*args, **kwargs) content ? @view.render(instance) { content } : @view.render(instance, &block) end |
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ Boolean
22 23 24 25 26 27 |
# File 'app/helpers/jet_ui_helper.rb', line 22 def respond_to_missing?(name, include_private = false) resolve_component(name) true rescue NameError super end |