Class: Hanami::Action::ViewNameInferrer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/action/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.

Since:

  • 2.0.0

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.

Since:

  • 2.0.0

{
  "create" => "new",
  "update" => "edit"
}.freeze

Class Method Summary collapse

Class Method Details

.call(action_name:, provider:) ⇒ Object

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.

Since:

  • 2.0.0



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/hanami/action/view_name_inferrer.rb', line 18

def call(action_name:, provider:)
  application = provider.respond_to?(:application) ? provider.application : Hanami.application

  action_identifier_base = application.config.actions.name_inference_base
  view_identifier_base = application.config.actions.view_name_inference_base

  identifier = action_identifier_name(action_name, provider, action_identifier_base)

  view_name = [view_identifier_base, identifier].compact.join(".")

  [view_name, alternative_view_name(view_name)].compact
end