Class: Hanami::CLI::Commands::App::Generate::Component Private

Inherits:
Command show all
Defined in:
lib/hanami/cli/commands/app/generate/component.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.2.0

Constant Summary

Constants inherited from Command

Command::ACTION_SEPARATOR

Instance Method Summary collapse

Methods inherited from Command

#app, inherited, #measure, #run_command

Methods inherited from Hanami::CLI::Command

new

Constructor Details

#initialize(fs:, inflector:, generator: Generators::App::Component.new(fs: fs, inflector: inflector), **opts) ⇒ Component

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 Component.

Since:

  • 2.2.0



28
29
30
31
32
33
34
35
# File 'lib/hanami/cli/commands/app/generate/component.rb', line 28

def initialize(
  fs:, inflector:,
  generator: Generators::App::Component.new(fs: fs, inflector: inflector),
  **opts
)
  @generator = generator
  super(fs: fs, inflector: inflector, **opts)
end

Instance Method Details

#call(name:, slice: nil) ⇒ 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.2.0



39
40
41
42
43
# File 'lib/hanami/cli/commands/app/generate/component.rb', line 39

def call(name:, slice: nil, **)
  slice = inflector.underscore(Shellwords.shellescape(slice)) if slice

  generator.call(app.namespace, name, slice)
end