Class: Hanami::CLI::Generators::App::ClassFile Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/cli/generators/app/ruby_file_writer.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.

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(fs:, inflector:, key:, namespace:, base_path:, relative_parent_class:, extra_namespace: nil, body: []) ⇒ ClassFile

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 ClassFile.

Since:

  • 2.0.0



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/hanami/cli/generators/app/ruby_file_writer.rb', line 45

def initialize(
  fs:,
  inflector:,
  key:,
  namespace:,
  base_path:,
  relative_parent_class:,
  extra_namespace: nil,
  body: []
)
  @fs = fs
  @inflector = inflector
  @key = key
  @namespace = namespace
  @base_path = base_path
  @extra_namespace = extra_namespace&.downcase
  @relative_parent_class = relative_parent_class
  @body = body
end

Instance Method Details

#writeObject

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.

Since:

  • 2.0.0



65
66
67
# File 'lib/hanami/cli/generators/app/ruby_file_writer.rb', line 65

def write
  fs.write(path, file_contents)
end