Class: Foobara::Generators::TypeGenerator::Generators::TypeGenerator
- Inherits:
-
FilesGenerator
- Object
- FilesGenerator
- Foobara::Generators::TypeGenerator::Generators::TypeGenerator
- Defined in:
- foobara-type-generator-0.0.4/src/type_generator.rb
Constant Summary
Constants included from TruncatedInspect
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
Methods included from TruncatedInspect
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/type_generator.rb', line 7 def manifest_to_generator_classes(manifest) case manifest when TypeConfig [ Generators::TypeGenerator ] 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'src/type_generator.rb', line 25 def target_path domain_path, post_domain_path = if has_domain? [self.domain_path, self.post_domain_path] else *path, file = module_path.map { |part| Util.underscore(part) } [path, [file]] end domain_path = domain_path.map { |part| Util.underscore(part) } post_domain_path = post_domain_path.map { |part| Util.underscore(part) } *post_domain_path, file = post_domain_path path = ["src", *domain_path] unless path.last == "types" path << "types" end [*path, *post_domain_path, "#{file}.rb"] end |
#template_path ⇒ Object
21 22 23 |
# File 'src/type_generator.rb', line 21 def template_path ["src", "#{type}.rb.erb"] end |
#templates_dir ⇒ Object
49 50 51 |
# File 'src/type_generator.rb', line 49 def templates_dir "#{__dir__}/../templates" end |