Class: Foobara::Generators::CommandGenerator::Generators::CommandSpecGenerator

Inherits:
CommandGenerator show all
Defined in:
foobara-command-generator-0.1.0/src/command_spec_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 CommandGenerator

manifest_to_generator_classes, #templates_dir

Methods inherited from FilesGenerator

#==, #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

Methods included from TruncatedInspect

#inspect, truncating

Constructor Details

This class inherits a constructor from Foobara::FilesGenerator

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Foobara::FilesGenerator

Instance Method Details

#target_path ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'src/command_spec_generator.rb', line 12

def target_path
  *path, file = module_path.map { |part| Util.underscore(part) }

  file = "#{file}_spec.rb"

  if top_level
    ["spec", file]
  else
    ["spec", *path, file]
  end
end

#template_path ⇒ Object



8
9
10
# File 'src/command_spec_generator.rb', line 8

def template_path
  ["spec", "command_spec.rb.erb"]
end