Class: Foobara::Generators::DomainGenerator::Generators::DomainGenerator

Inherits:
FilesGenerator
  • Object
show all
Defined in:
foobara-domain-generator-0.0.3/src/domain_generator.rb

Constant Summary

Constants included from TruncatedInspect

TruncatedInspect::MAX_LENGTH

Instance Attribute Summary

Attributes inherited from FilesGenerator

#belongs_to_dependency_group, #relevant_manifest

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FilesGenerator

#==, #absolute_template_path, #applicable?, #dependencies, #dependencies_to_generate, #eql?, #erb_template, #generate, generator_for, #generator_for, generators_for, #generators_for, #hash, #initialize, #method_missing, #path_to_root, #respond_to_missing?, #target_dir, #template_string

Methods included from FilesGenerator::BundlerActions

#bundle_install

Methods included from TruncatedInspect

#inspect, truncating

Constructor Details

This class inherits a constructor from Foobara::FilesGenerator

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Foobara::FilesGenerator

Class Method Details

.manifest_to_generator_classes(manifest) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'src/domain_generator.rb', line 7

def manifest_to_generator_classes(manifest)
  case manifest
  when DomainConfig
    [
      Generators::DomainGenerator
    ]
  else
    # :nocov:
    raise "Not sure how build a generator for a #{manifest}"
    # :nocov:
  end
end

Instance Method Details

#target_path ⇒ Object



25
26
27
28
29
30
31
# File 'src/domain_generator.rb', line 25

def target_path
  *path, file = module_path.map { |part| Util.underscore(part) }

  file = "#{file}.rb"

  ["src", *path, file]
end

#template_path ⇒ Object



21
22
23
# File 'src/domain_generator.rb', line 21

def template_path
  ["src", "domain.rb.erb"]
end

#templates_dir ⇒ Object



35
36
37
# File 'src/domain_generator.rb', line 35

def templates_dir
  "#{__dir__}/../templates"
end