Class: Hanami::CLI::Generators::App::Operation Private
- Inherits:
-
Object
- Object
- Hanami::CLI::Generators::App::Operation
- Defined in:
- lib/hanami/cli/generators/app/operation.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.
Instance Method Summary collapse
- #call(key:, namespace:, base_path:) ⇒ Object private
-
#initialize(fs:, inflector:, out: $stdout) ⇒ Operation
constructor
private
A new instance of Operation.
Constructor Details
#initialize(fs:, inflector:, out: $stdout) ⇒ Operation
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 Operation.
14 15 16 17 18 |
# File 'lib/hanami/cli/generators/app/operation.rb', line 14 def initialize(fs:, inflector:, out: $stdout) @fs = fs @inflector = inflector @out = out end |
Instance Method Details
#call(key:, namespace:, base_path:) ⇒ 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.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hanami/cli/generators/app/operation.rb', line 22 def call(key:, namespace:, base_path:) RubyFileWriter.new( fs: fs, inflector: inflector, ).call( namespace: namespace, base_path: base_path, key: key, relative_parent_class: "Operation", body: ["def call", "end"], ) unless key.match?(KEY_SEPARATOR) out.puts( " Note: We generated a top-level operation. " \ "To generate into a directory, add a namespace: `my_namespace.add_book`" ) end end |