Class: Charming::Generators::Base

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

Overview

Base is the parent class for all Charming file generators. Subclasses implement ‘generate` to write the appropriate files. The base class provides `create_file`, which writes content to a path under the configured destination and refuses to overwrite existing files unless force was set.

Direct Known Subclasses

AppFileGenerator, AppGenerator

Instance Method Summary collapse

Constructor Details

#initialize(out:, destination:, force: false) ⇒ Base

out is the status-output stream. destination is the app root for generated files. force (default false) allows overwriting existing files.



14
15
16
17
18
# File 'lib/charming/generators/base.rb', line 14

def initialize(out:, destination:, force: false)
  @out = out
  @destination = destination
  @force = force
end