Class: VcShortcut::ChainContext
- Inherits:
-
Object
- Object
- VcShortcut::ChainContext
- Defined in:
- lib/vc_shortcut/chain_context.rb
Instance Attribute Summary collapse
-
#call_args ⇒ Object
Arguments for the leaf component.
-
#call_block ⇒ Object
Arguments for the leaf component.
-
#call_kwargs ⇒ Object
Arguments for the leaf component.
-
#chain ⇒ Object
readonly
Chain until now.
-
#component ⇒ Object
The leaf component found by the ‘find` proc when registering a shortcut.
-
#view_context ⇒ Object
readonly
The view_context (e.g an ActionView::Base or a ViewComponent instance).
Instance Method Summary collapse
- #chain_camelized(rindex = -1)) ⇒ Object
-
#initialize(view_context) ⇒ ChainContext
constructor
A new instance of ChainContext.
Constructor Details
#initialize(view_context) ⇒ ChainContext
Returns a new instance of ChainContext.
17 18 19 20 21 22 23 24 |
# File 'lib/vc_shortcut/chain_context.rb', line 17 def initialize(view_context) @view_context = view_context @chain = [] @component = nil @call_args = [] @call_kwargs = {} @call_block = nil end |
Instance Attribute Details
#call_args ⇒ Object
Arguments for the leaf component
15 16 17 |
# File 'lib/vc_shortcut/chain_context.rb', line 15 def call_args @call_args end |
#call_block ⇒ Object
Arguments for the leaf component
15 16 17 |
# File 'lib/vc_shortcut/chain_context.rb', line 15 def call_block @call_block end |
#call_kwargs ⇒ Object
Arguments for the leaf component
15 16 17 |
# File 'lib/vc_shortcut/chain_context.rb', line 15 def call_kwargs @call_kwargs end |
#chain ⇒ Object (readonly)
Chain until now. E.g if you call vc.admin.button When processing :admin, chain will be [:admin] Then, when processing :button, chain will be [:admin, :button]
9 10 11 |
# File 'lib/vc_shortcut/chain_context.rb', line 9 def chain @chain end |
#component ⇒ Object
The leaf component found by the ‘find` proc when registering a shortcut
12 13 14 |
# File 'lib/vc_shortcut/chain_context.rb', line 12 def component @component end |
#view_context ⇒ Object (readonly)
The view_context (e.g an ActionView::Base or a ViewComponent instance)
4 5 6 |
# File 'lib/vc_shortcut/chain_context.rb', line 4 def view_context @view_context end |
Instance Method Details
#chain_camelized(rindex = -1)) ⇒ Object
26 27 28 |
# File 'lib/vc_shortcut/chain_context.rb', line 26 def chain_camelized(rindex = -1) @chain[0..rindex].join('/').camelize end |