Class: Card::Generators::SetGenerator

Inherits:
NamedBase
  • Object
show all
Defined in:
lib/generators/card/set/set_generator.rb

Instance Method Summary collapse

Methods inherited from NamedBase

#mod_path

Methods included from ClassMethods

#banner, #source_root

Instance Method Details

#create_filesObject



16
17
18
19
# File 'lib/generators/card/set/set_generator.rb', line 16

def create_files
  template "set_template.erb", set_path
  template "set_spec_template.erb", set_path("spec")
end

#set_path(modifier = nil) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/generators/card/set/set_generator.rb', line 21

def set_path modifier=nil
  suffix = modifier ? "_#{modifier}" : nil
  filename = "#{anchors.last}#{suffix}.rb"
  dirs = anchors[0..-2]
  path_parts = [mod_path, modifier, "set", set_pattern, dirs, filename]
  File.join(*path_parts.compact)
end