Class: Proscenium::LinkToComponentArguments
- Inherits:
-
Object
- Object
- Proscenium::LinkToComponentArguments
- Defined in:
- lib/proscenium/link_to_helper.rb
Overview
Component handling for the `link_to` helper.
Instance Method Summary collapse
- #helper_options ⇒ Object
-
#initialize(options, name_argument_index, context) ⇒ LinkToComponentArguments
constructor
A new instance of LinkToComponentArguments.
Constructor Details
#initialize(options, name_argument_index, context) ⇒ LinkToComponentArguments
Returns a new instance of LinkToComponentArguments.
26 27 28 29 30 31 32 33 34 |
# File 'lib/proscenium/link_to_helper.rb', line 26 def initialize(, name_argument_index, context) @options = @name_argument_index = name_argument_index @component = @options[@name_argument_index] # We have to render the component, and then extract the props from the component. Rendering # first ensures that we have all the correct props. context.render @component end |
Instance Method Details
#helper_options ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/proscenium/link_to_helper.rb', line 36 def @options[@name_argument_index] = "/components#{@component.virtual_path}" @options[@name_argument_index += 1] ||= {} @options[@name_argument_index][:rel] = 'nofollow' @options[@name_argument_index][:data] ||= {} @options[@name_argument_index][:data][:component] = { path: @component.virtual_path, props: @component.props } @options end |