Class: Hanami::Slice::ViewNameInferrer Private
- Inherits:
-
Object
- Object
- Hanami::Slice::ViewNameInferrer
- Defined in:
- lib/hanami/slice/view_name_inferrer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Infers a view name for automatically rendering within actions.
Constant Summary collapse
- ALTERNATIVE_NAMES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ "create" => "new", "update" => "edit" }.freeze
Class Method Summary collapse
-
.call(action_class_name:, slice:) ⇒ Array<string>
private
Returns an array of container keys for views matching the given action.
Class Method Details
.call(action_class_name:, slice:) ⇒ Array<string>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns an array of container keys for views matching the given action.
Also provides alternative view keys for common RESTful actions.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/hanami/slice/view_name_inferrer.rb', line 30 def call(action_class_name:, slice:) action_key_base = slice.config.actions.name_inference_base view_key_base = slice.config.actions.view_name_inference_base action_name_key = action_name_key(action_class_name, slice, action_key_base) view_key = [view_key_base, action_name_key].compact.join(CONTAINER_KEY_DELIMITER) [view_key, alternative_view_key(view_key)].compact end |