Class: Hanami::CLI::Commands::App::Generate::Command Private
- Inherits:
-
Command
- Object
- Dry::CLI::Command
- Hanami::CLI::Command
- Command
- Hanami::CLI::Commands::App::Generate::Command
- Defined in:
- lib/hanami/cli/commands/app/generate/command.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.
Constant Summary
Constants inherited from Command
Instance Method Summary collapse
- #call(name:, slice: nil) ⇒ Object private
- #generator_class ⇒ Object private
-
#initialize(fs:, inflector:, **opts) ⇒ Command
constructor
private
A new instance of Command.
Methods inherited from Command
#app, inherited, #measure, #run_command
Methods inherited from Hanami::CLI::Command
Constructor Details
#initialize(fs:, inflector:, **opts) ⇒ Command
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 Command.
24 25 26 27 28 29 30 31 |
# File 'lib/hanami/cli/commands/app/generate/command.rb', line 24 def initialize( fs:, inflector:, **opts ) super @generator = generator_class.new(fs: fs, inflector: inflector, out: out) 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.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hanami/cli/commands/app/generate/command.rb', line 40 def call(name:, slice: nil, **) if slice generator.call( key: name, namespace: slice, base_path: fs.join("slices", inflector.underscore(slice)) ) else generator.call( key: name, namespace: app.namespace, base_path: "app" ) end end |
#generator_class ⇒ 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.
33 34 35 36 |
# File 'lib/hanami/cli/commands/app/generate/command.rb', line 33 def generator_class # Must be implemented by subclasses, with class that takes: # fs:, inflector:, out: end |