Class: Card::Generators::FormatGenerator

Inherits:
NamedBase
  • Object
show all
Defined in:
lib/generators/card/format/format_generator.rb

Instance Method Summary collapse

Methods inherited from NamedBase

#mod_path

Methods included from ClassMethods

#banner, #source_root

Instance Method Details

#create_filesObject



15
16
17
18
# File 'lib/generators/card/format/format_generator.rb', line 15

def create_files
  template "format_template.erb", format_path
  template "format_spec_template.erb", format_path("spec")
end

#format_path(modifier = nil) ⇒ Object



20
21
22
23
24
25
# File 'lib/generators/card/format/format_generator.rb', line 20

def format_path modifier=nil
  suffix = modifier ? "_#{modifier}" : nil
  filename = "#{module_name}_format#{suffix}.rb"
  path_parts = [mod_path, modifier, "format", filename].compact
  File.join(*path_parts)
end