Class: Foobara::RemoteGenerator::Services::CommandGenerator

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

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 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

#base_class_nameObject



43
44
45
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_generator.rb', line 43

def base_class_name
  base_class_path.split("/").last
end

#base_class_pathObject



39
40
41
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_generator.rb', line 39

def base_class_path
  "base/RemoteCommand"
end

#command_errors_index_generatorObject



35
36
37
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_generator.rb', line 35

def command_errors_index_generator
  Services::CommandErrorsIndexGenerator.new(command_manifest)
end

#dependenciesObject



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

def dependencies
  errors_in_this_namespace
end

#domain_generatorObject



17
18
19
# File 'foobara-typescript-remote-command-generator-0.0.18/src/remote_generator/services/command_generator.rb', line 17

def domain_generator
  @domain_generator ||= Services::DomainGenerator.new(domain)
end

#errors_in_this_namespaceObject



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

def errors_in_this_namespace
  @errors_in_this_namespace ||= possible_errors.values.map(&:error).uniq.sort_by(&:error_name).select do |error|
    error.parent&.path&.map(&:to_s) == path.map(&:to_s)
  end.map do |error_manifest|
    Services::ErrorGenerator.new(error_manifest)
  end
end

#target_pathObject



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

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

#template_pathObject



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

def template_path
  "Command.ts.erb"
end