Class: AspenFile

Inherits:
Object
  • Object
show all
Defined in:
lib/aspen_file.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(templ, direc, file) ⇒ AspenFile

Returns a new instance of AspenFile.



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

def initialize(templ, direc, file)
  @templ = templ
  if direc.length != 0
    @direc = direc + "/" 
  else
    @direc = ""
  end
  @file = file
  @@all << self
end

Instance Attribute Details

#direcObject (readonly)

Returns the value of attribute direc.



5
6
7
# File 'lib/aspen_file.rb', line 5

def direc
  @direc
end

#fileObject (readonly)

Returns the value of attribute file.



5
6
7
# File 'lib/aspen_file.rb', line 5

def file
  @file
end

#templObject (readonly)

Returns the value of attribute templ.



5
6
7
# File 'lib/aspen_file.rb', line 5

def templ
  @templ
end

Class Method Details

.allObject



9
10
11
# File 'lib/aspen_file.rb', line 9

def self.all
  @@all
end

Instance Method Details

#create(root) ⇒ Object



24
25
26
27
# File 'lib/aspen_file.rb', line 24

def create(root)
  FileUtils.cp("#{self.templ}/#{self.file[0]}", "#{root}#{self.direc}#{self.file[0]}")
  puts "  create   #{self.direc}#{self.file[0]}"
end