Class: DiceBag::DefaultTemplateFile

Inherits:
Object
  • Object
show all
Includes:
DiceBagFile
Defined in:
lib/dice_bag/default_template_file.rb

Instance Attribute Summary

Attributes included from DiceBagFile

#destination, #file, #filename

Instance Method Summary collapse

Methods included from DiceBagFile

#assert_existence, #should_write?, #write

Constructor Details

#initialize(name, location = nil, save_as = nil) ⇒ DefaultTemplateFile

Returns a new instance of DefaultTemplateFile.



14
15
16
17
18
19
20
21
# File 'lib/dice_bag/default_template_file.rb', line 14

def initialize(name, location = nil, save_as = nil)
  # if called from command line with only a name we search in all our templates for the file
  name = AvailableTemplates.template_filename_for(name) if File.dirname(name) == "."
  @filename = File.basename(save_as || name)
  @file = name
  @template_location = location
  @destination = File.join(Project.root, @template_location, @filename)
end