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) ⇒ DefaultTemplateFile

Returns a new instance of DefaultTemplateFile.


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

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