Module: ComponentParty::ActionView::Renderer
- Defined in:
- lib/component_party/action_view/renderer.rb
Instance Method Summary collapse
-
#normalize_component_path!(_context, options) ⇒ void
An example of options argumento passed by Rails are { :prefixes=>["devise/sessions", "devise", "application"], :template=>"new", :layout=> a Proc } rubocop:disable Metrics/LineLength.
- #normalize_data_for_component_rendering!(context, options) ⇒ void
- #render(context, options) ⇒ void
Instance Method Details
#normalize_component_path!(_context, options) ⇒ void
An example of options argumento passed by Rails are { :prefixes=>["devise/sessions", "devise", "application"], :template=>"new", :layout=> a Proc } rubocop:disable Metrics/LineLength
26 27 28 29 30 31 32 |
# File 'lib/component_party/action_view/renderer.rb', line 26 def normalize_component_path!(_context, ) if [:component] == true [:component] = Pathname.new(ComponentParty.configuration.component_folder_for_actions).join([:prefixes].first.to_s, [:template]).to_s else [:component] end end |
#normalize_data_for_component_rendering!(context, options) ⇒ void
14 15 16 17 |
# File 'lib/component_party/action_view/renderer.rb', line 14 def normalize_data_for_component_rendering!(context, ) normalize_component_path!(context, ) context.instance_variable_set('@current_component_path', [:component]) end |
#render(context, options) ⇒ void
5 6 7 8 9 10 11 12 |
# File 'lib/component_party/action_view/renderer.rb', line 5 def render(context, ) if .key?(:component) normalize_data_for_component_rendering!(context, ) ComponentParty::ActionView::ComponentRenderer.new(lookup_context, [:component]).render(context, ) else super(context, ) end end |