Class: Hanami::CLI::Generators::App::Relation Private
- Inherits:
-
Object
- Object
- Hanami::CLI::Generators::App::Relation
- Defined in:
- lib/hanami/cli/generators/app/relation.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:, gateway:) ⇒ Object private
-
#initialize(fs:, inflector:, out: $stdout) ⇒ Relation
constructor
private
A new instance of Relation.
Constructor Details
#initialize(fs:, inflector:, out: $stdout) ⇒ Relation
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 Relation.
14 15 16 17 18 |
# File 'lib/hanami/cli/generators/app/relation.rb', line 14 def initialize(fs:, inflector:, out: $stdout) @fs = fs @inflector = inflector @out = out end |
Instance Method Details
#call(key:, namespace:, base_path:, gateway:) ⇒ 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 |
# File 'lib/hanami/cli/generators/app/relation.rb', line 22 def call(key:, namespace:, base_path:, gateway:) schema_name = key.split(KEY_SEPARATOR).last body_content = ["schema :#{schema_name}, infer: true"] body_content.prepend("gateway :#{gateway}") if gateway RubyFileWriter.new( fs: fs, inflector: inflector, ).call( namespace: namespace, key: key, base_path: base_path, extra_namespace: "Relations", relative_parent_class: "DB::Relation", body: body_content, ) end |