Module: Wallaby::View::ActionViewable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Wallaby::View
- Defined in:
- lib/wallaby/view/action_viewable.rb
Overview
This module overrides Rails core methods #lookup_context and #_prefixes to provide better performance and more lookup prefixes.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#_prefixes(prefixes: nil, controller_path: nil, action_name: nil, themes: nil, options: nil, &block) ⇒ Array<String>
Override _prefixes to allow other (e.g. CustomPrefixes#action_name, CustomPrefixes#themes) to be added to the prefixes list.
-
#lookup_context ⇒ CustomLookupContext
Override lookup_context to provide caching for template/partial lookup.
-
#original_lookup_context ⇒ ActionView::LookupContext
Original method of #lookup_context.
-
#original_prefixes ⇒ Array<String>
Original method of #_prefixes.
-
#override_lookup_context ⇒ CustomLookupContext
Override lookup_context to provide caching for template/partial lookup.
-
#override_prefixes(prefixes: nil, action_name: nil, themes: nil, options: nil, &block) ⇒ Array<String>
Override _prefixes to allow other (e.g. CustomPrefixes#action_name, CustomPrefixes#themes) to be added to the prefixes list.
Instance Method Details
#_prefixes(prefixes: nil, controller_path: nil, action_name: nil, themes: nil, options: nil, &block) ⇒ Array<String>
Override _prefixes to allow other (e.g. CustomPrefixes#action_name, CustomPrefixes#themes) to be added to the prefixes list.
|
# File 'lib/wallaby/view/action_viewable.rb', line 49
|
#lookup_context ⇒ CustomLookupContext
Override lookup_context to provide caching for template/partial lookup.
|
# File 'lib/wallaby/view/action_viewable.rb', line 37
|
#original_lookup_context ⇒ ActionView::LookupContext
Original method of #lookup_context
|
# File 'lib/wallaby/view/action_viewable.rb', line 29
|
#original_prefixes ⇒ Array<String>
Original method of #_prefixes
|
# File 'lib/wallaby/view/action_viewable.rb', line 33
|
#override_lookup_context ⇒ CustomLookupContext
Override lookup_context to provide caching for template/partial lookup.
44 45 46 47 |
# File 'lib/wallaby/view/action_viewable.rb', line 44 def override_lookup_context @_lookup_context ||= # rubocop:disable Naming/MemoizedInstanceVariableName CustomLookupContext.convert(original_lookup_context, prefixes: _prefixes) end |
#override_prefixes(prefixes: nil, action_name: nil, themes: nil, options: nil, &block) ⇒ Array<String>
Override _prefixes to allow other (e.g. CustomPrefixes#action_name, CustomPrefixes#themes) to be added to the prefixes list.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/wallaby/view/action_viewable.rb', line 60 def override_prefixes( prefixes: nil, action_name: nil, themes: nil, options: nil, &block ) @_prefixes ||= # rubocop:disable Naming/MemoizedInstanceVariableName CustomPrefixes.execute( prefixes: prefixes || original_prefixes, action_name: action_name || params[:action], themes: themes || self.class.themes, options: self.class..merge( || {}), &block ) end |