Class: Charming::Generators::AppFileGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/charming/generators/app_file_generator.rb

Overview

AppFileGenerator is the parent class for “in-app” sub-generators (controller, model, screen, view, component) that run inside an existing Charming app. It derives the app’s namespace from the local gemspec and exposes path-building helpers that put files under the right ‘app/…` subdirectory.

Instance Method Summary collapse

Constructor Details

#initialize(name, _args, out:, destination:, force: false) ⇒ AppFileGenerator

name is the singular resource name (e.g., “user”). _args are subcommand-specific (e.g., controller actions or model fields). out, destination, and force are forwarded to Base.



13
14
15
16
17
# File 'lib/charming/generators/app_file_generator.rb', line 13

def initialize(name, _args, out:, destination:, force: false)
  super(out: out, destination: destination, force: force)
  @name = Name.new(name)
  @app_name = Name.new(app_name_from_gemspec)
end