Class: Foobara::RemoteGenerator::Generators::ModelGenerator
- Inherits:
-
TypeGenerator
show all
- Defined in:
- foobara-typescript-remote-command-generator-1.3.1/src/generators/model_generator.rb
Constant Summary
TruncatedInspect::MAX_LENGTH
Instance Attribute Summary
#belongs_to_dependency_group, #relevant_manifest
Class Method Summary
collapse
Instance Method Summary
collapse
#aggregate_attributes_ts_type, #atom_attributes_ts_type, #attribute_names, #attributes_type_ts_type, #custom_type_generators, #dependencies, lru_cache, #model_generators, #scoped_full_path, #type_guts, #type_name, #type_name_downcase, #type_prefix, #type_short_name
#==, #attributes_to_ts_type, #auto_dirty_queries?, #collision_winners, #custom_type_to_ts_type_name, #dependency_group, #dependency_roots, #domain_name, #foobara_type_to_ts_type, #hash, #import_path, #import_path_array, #initialize, manifest_to_generator_classes, #model_to_ts_model_name, #organization_name, #parent, #path_to_root, #templates_dir, #ts_instance_full_name, #ts_instance_full_path, #value_to_ts_value, #will_define
#==, #absolute_template_path, #applicable?, #dependencies, #dependencies_to_generate, #eql?, #erb_template, #generate, generator_for, #generator_for, generators_for, #generators_for, #hash, #initialize, manifest_to_generator_classes, #method_missing, #path_to_root, #respond_to_missing?, #target_dir, #template_string, #templates_dir
#inspect, truncating
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Foobara::FilesGenerator
Class Method Details
.new(relevant_manifest) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'src/generators/model_generator.rb', line 9
def new(relevant_manifest)
return super unless self == ModelGenerator
if relevant_manifest.detached_entity?
EntityGenerator.new(relevant_manifest)
else
super
end
end
|
Instance Method Details
#generated_type ⇒ Object
50
51
52
|
# File 'src/generators/model_generator.rb', line 50
def generated_type
model_short_name
end
|
#import_destructure ⇒ Object
54
55
56
|
# File 'src/generators/model_generator.rb', line 54
def import_destructure
"{ #{generated_type} }"
end
|
#model_name(points = nil) ⇒ Object
42
43
44
|
# File 'src/generators/model_generator.rb', line 42
def model_name(points = nil)
type_name(points)
end
|
#model_name_downcase ⇒ Object
46
47
48
|
# File 'src/generators/model_generator.rb', line 46
def model_name_downcase
type_name_downcase
end
|
#model_prefix ⇒ Object
38
39
40
|
# File 'src/generators/model_generator.rb', line 38
def model_prefix
type_prefix
end
|
#model_short_name ⇒ Object
30
31
32
|
# File 'src/generators/model_generator.rb', line 30
def model_short_name
type_short_name
end
|
#target_path ⇒ Object
22
23
24
|
# File 'src/generators/model_generator.rb', line 22
def target_path
[*domain.scoped_full_path, "Types", *model_prefix, model_short_name, "#{model_short_name}.ts"]
end
|
#template_path ⇒ Object
34
35
36
|
# File 'src/generators/model_generator.rb', line 34
def template_path
["Model", "Model.ts.erb"]
end
|
#ts_instance_path ⇒ Object
26
27
28
|
# File 'src/generators/model_generator.rb', line 26
def ts_instance_path
[*model_prefix, scoped_short_name]
end
|