Class: Foobara::RemoteGenerator::Services::CommandInputsGenerator
- Inherits:
-
TypescriptFromManifestBaseGenerator
- Object
- FilesGenerator
- TypescriptFromManifestBaseGenerator
- Foobara::RemoteGenerator::Services::CommandInputsGenerator
- Defined in:
- foobara-typescript-remote-command-generator-0.0.18/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 ⇒ 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, #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
33 34 35 |
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_inputs_generator.rb', line 33 def dependencies type_generators end |
#model_and_entity_free_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 |
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_inputs_generator.rb', line 23 def model_and_entity_free_types_depended_on inputs_types_depended_on.reject { |type| type.model? || type.entity? }.reject(&:builtin?).uniq end |
#target_path ⇒ Object
9 10 11 |
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_inputs_generator.rb', line 9 def target_path [*scoped_full_path, "Inputs.ts"] end |
#template_path ⇒ Object
13 14 15 |
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_inputs_generator.rb', line 13 def template_path "Command/Inputs.ts.erb" end |
#type_generators ⇒ Object
27 28 29 30 31 |
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_inputs_generator.rb', line 27 def type_generators @type_generators ||= model_and_entity_free_types_depended_on.uniq.map do |type| TypeGenerator.new(type) end end |