Class: Hanami::CLI::Commands::App::Generate::Action Private
- Inherits:
-
Command
- Object
- Dry::CLI::Command
- Hanami::CLI::Command
- Command
- Hanami::CLI::Commands::App::Generate::Action
- Defined in:
- lib/hanami/cli/commands/app/generate/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.
Constant Summary
Constants inherited from Command
Instance Method Summary collapse
- #call(name:, url: nil, http: nil, format: DEFAULT_FORMAT, skip_view: DEFAULT_SKIP_VIEW, skip_tests: DEFAULT_SKIP_TESTS, skip_route: DEFAULT_SKIP_ROUTE, slice: nil, context: nil) ⇒ Object private
-
#initialize(fs:, inflector:, naming: Naming.new(inflector: inflector), generator: Generators::App::Action.new(fs: fs, inflector: inflector), **opts) ⇒ Action
constructor
private
A new instance of Action.
Methods inherited from Command
#app, inherited, #measure, #run_command
Methods inherited from Hanami::CLI::Command
Constructor Details
#initialize(fs:, inflector:, naming: Naming.new(inflector: inflector), generator: Generators::App::Action.new(fs: fs, inflector: inflector), **opts) ⇒ 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.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/hanami/cli/commands/app/generate/action.rb', line 73 def initialize( fs:, inflector:, naming: Naming.new(inflector: inflector), generator: Generators::App::Action.new(fs: fs, inflector: inflector), **opts ) super(fs: fs, inflector: inflector, **opts) @naming = naming @generator = generator end |
Instance Method Details
#call(name:, url: nil, http: nil, format: DEFAULT_FORMAT, skip_view: DEFAULT_SKIP_VIEW, skip_tests: DEFAULT_SKIP_TESTS, skip_route: DEFAULT_SKIP_ROUTE, slice: nil, context: 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.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/hanami/cli/commands/app/generate/action.rb', line 89 def call( name:, url: nil, http: nil, format: DEFAULT_FORMAT, skip_view: DEFAULT_SKIP_VIEW, skip_tests: DEFAULT_SKIP_TESTS, # rubocop:disable Lint/UnusedMethodArgument, skip_route: DEFAULT_SKIP_ROUTE, slice: nil, context: nil, ** ) slice = inflector.underscore(Shellwords.shellescape(slice)) if slice name = naming.action_name(name) *controller, action = name.split(ACTION_SEPARATOR) if controller.empty? raise InvalidActionNameError.new(name) end generator.call(app.namespace, controller, action, url, http, format, skip_view, skip_route, slice, context: context) end |