Class: InertiaBuilder::PropBuilder
- Inherits:
-
JbuilderTemplate
- Object
- JbuilderTemplate
- InertiaBuilder::PropBuilder
- Defined in:
- lib/inertia_builder.rb
Instance Method Summary collapse
- #always!(&block) ⇒ Object
- #defer!(**opts, &block) ⇒ Object
- #method_missing(name, *args, &block) ⇒ Object
- #optional!(&block) ⇒ Object
- #scroll!(metadata = nil, **opts, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/inertia_builder.rb', line 33 def method_missing(name, *args, &block) prop = self if @inertia_block method, positional_args, opts = @inertia_block _set_value(name, ::InertiaRails.send(method, *positional_args, **opts) { prop.set!(name, *args, &block) }) elsif !@in_scope # Lazy evaluate outermost properties. _set_value(name, -> { prop.set!(name, *args, &block); }) else super end end |
Instance Method Details
#always!(&block) ⇒ Object
21 22 23 |
# File 'lib/inertia_builder.rb', line 21 def always!(&block) _call_inertia_block(:always, &block) end |
#defer!(**opts, &block) ⇒ Object
25 26 27 |
# File 'lib/inertia_builder.rb', line 25 def defer!(**opts, &block) _call_inertia_block(:defer, **opts, &block) end |
#optional!(&block) ⇒ Object
17 18 19 |
# File 'lib/inertia_builder.rb', line 17 def optional!(&block) _call_inertia_block(:optional, &block) end |
#scroll!(metadata = nil, **opts, &block) ⇒ Object
29 30 31 |
# File 'lib/inertia_builder.rb', line 29 def scroll!( = nil, **opts, &block) _call_inertia_block(:scroll, , **opts, &block) end |