Class: Foobara::RemoteGenerator::Services::CommandErrorsGenerator

Inherits:
CommandGenerator show all
Defined in:
foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_errors_generator.rb

Direct Known Subclasses

CommandErrorsIndexGenerator

Constant Summary

Constants included from TruncatedInspect

TruncatedInspect::MAX_LENGTH

Instance Attribute Summary

Attributes inherited from FilesGenerator

#belongs_to_dependency_group, #relevant_manifest

Instance Method Summary collapse

Methods inherited from CommandGenerator

#base_class_name, #base_class_path, #command_errors_index_generator, #domain_generator, #errors_in_this_namespace

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

#inspect, truncating

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

#dependenciesObject



30
31
32
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_errors_generator.rb', line 30

def dependencies
  error_generators
end

#error_generatorsObject



18
19
20
21
22
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_errors_generator.rb', line 18

def error_generators
  @error_generators ||= possible_errors.values.map(&:error).sort_by(&:error_name).uniq.map do |error|
    Services::ErrorGenerator.new(error)
  end
end

#error_type_unionObject



24
25
26
27
28
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_errors_generator.rb', line 24

def error_type_union
  error_generators.map do |error_generator|
    dependency_group.non_colliding_type(error_generator)
  end.join(" |\n  ")
end

#target_pathObject



10
11
12
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_errors_generator.rb', line 10

def target_path
  [*scoped_full_path, "Errors.ts"]
end

#template_pathObject



14
15
16
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_errors_generator.rb', line 14

def template_path
  "Command/Errors.ts.erb"
end