Class: Hanami::CLI::Generators::App::Action Private

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

Instance Method Summary collapse

Constructor Details

#initialize(fs:, inflector:, out: $stdout) ⇒ Action

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 a new instance of Action.

Since:

  • 2.0.0



19
20
21
22
23
24
25
26
27
28
# File 'lib/hanami/cli/generators/app/action.rb', line 19

def initialize(fs:, inflector:, out: $stdout)
  @fs = fs
  @inflector = inflector
  @out = out
  @view_generator = Generators::App::View.new(
    fs: fs,
    inflector: inflector,
    out: out
  )
end

Instance Method Details

#call(key:, namespace:, base_path:, url_path:, http_method:, skip_view:, skip_route:, skip_tests:, force:, template_engine: DEFAULT_TEMPLATE_ENGINE) ⇒ 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



32
33
34
35
36
37
38
39
40
# File 'lib/hanami/cli/generators/app/action.rb', line 32

def call(key:, namespace:, base_path:, url_path:, http_method:, skip_view:, skip_route:, skip_tests:,
         force:, template_engine: DEFAULT_TEMPLATE_ENGINE)
  insert_route(key:, namespace:, url_path:, http_method:) unless skip_route

  generate_action(key: key, namespace: namespace, base_path: base_path, include_placeholder_body: skip_view,
    force:)

  generate_view(key:, namespace:, base_path:, template_engine:, force:) unless skip_view
end