Class: Foobara::RemoteGenerator::Services::CommandInputsGenerator
- Inherits:
-
TypescriptFromManifestBaseGenerator
- Object
- FilesGenerator
- TypescriptFromManifestBaseGenerator
- Foobara::RemoteGenerator::Services::CommandInputsGenerator
- Defined in:
- foobara-typescript-remote-command-generator-0.0.24/src/remote_generator/services/command_inputs_generator.rb
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary
Attributes inherited from FilesGenerator
#belongs_to_dependency_group, #relevant_manifest
Instance Method Summary collapse
- #dependencies ⇒ Object
-
#model_and_entity_free_types_depended_on(types_to_consider = inputs_types_depended_on) ⇒ Object
TODO: we should break the various TypeScript WhateverAttributesType and WhateverPrimaryKeyType into separate generators with separate templates so we can use those types instead of constructing new types from the attributes/primary keys of models/entities.
- #target_path ⇒ Object
- #template_path ⇒ Object
- #type_generators ⇒ Object
Methods inherited from TypescriptFromManifestBaseGenerator
#==, #attributes_to_ts_type, #custom_type_to_ts_type_name, #dependency_group, #dependency_roots, #foobara_type_to_ts_type, #hash, #import_destructure, #import_path, #import_path_array, #initialize, manifest_to_generator_classes, #model_to_ts_model_name, #parent, #path_to_root, #templates_dir, #ts_instance_full_name, #ts_instance_full_path, #ts_instance_path, #ts_type_full_path, #value_to_ts_value
Methods inherited from FilesGenerator
#==, #absolute_template_path, #applicable?, #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
Methods included from TruncatedInspect
Constructor Details
This class inherits a constructor from Foobara::RemoteGenerator::Services::TypescriptFromManifestBaseGenerator
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::FilesGenerator
Instance Method Details
#dependencies ⇒ Object
[View source]
49 50 51 |
# File 'foobara-typescript-remote-command-generator-0.0.24/src/remote_generator/services/command_inputs_generator.rb', line 49 def dependencies type_generators end |
#model_and_entity_free_types_depended_on(types_to_consider = inputs_types_depended_on) ⇒ Object
TODO: we should break the various TypeScript WhateverAttributesType and WhateverPrimaryKeyType into separate generators with separate templates so we can use those types instead of constructing new types from the attributes/primary keys of models/entities. Instead, for now, we will just translate input types to not have entities/models by converting models to their attributes and entities to their primary keys.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'foobara-typescript-remote-command-generator-0.0.24/src/remote_generator/services/command_inputs_generator.rb', line 23 def model_and_entity_free_types_depended_on(types_to_consider = inputs_types_depended_on) types = [] types_to_consider.each do |type| if type.is_a?(Manifest::TypeDeclaration) type = type.to_type end if type.detached_entity? types += model_and_entity_free_types_depended_on([type.primary_key_type]) elsif type.model? types += model_and_entity_free_types_depended_on(type.types_depended_on) elsif !type.builtin? types << type end end types end |
#target_path ⇒ Object
[View source]
9 10 11 |
# File 'foobara-typescript-remote-command-generator-0.0.24/src/remote_generator/services/command_inputs_generator.rb', line 9 def target_path [*scoped_full_path, "Inputs.ts"] end |
#template_path ⇒ Object
[View source]
13 14 15 |
# File 'foobara-typescript-remote-command-generator-0.0.24/src/remote_generator/services/command_inputs_generator.rb', line 13 def template_path "Command/Inputs.ts.erb" end |
#type_generators ⇒ Object
[View source]
43 44 45 46 47 |
# File 'foobara-typescript-remote-command-generator-0.0.24/src/remote_generator/services/command_inputs_generator.rb', line 43 def type_generators @type_generators ||= model_and_entity_free_types_depended_on.uniq.map do |type| TypeGenerator.new(type) end end |