Class: Avm::Files::Appendable::PlainDirectory

Inherits:
ResourceBase
  • Object
show all
Defined in:
lib/avm/files/appendable/plain_directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(appender, source_path) ⇒ PlainDirectory

Returns a new instance of PlainDirectory.



12
13
14
15
# File 'lib/avm/files/appendable/plain_directory.rb', line 12

def initialize(appender, source_path)
  super(appender)
  @source_path = source_path.to_pathname
end

Instance Attribute Details

#source_pathObject (readonly)

Returns the value of attribute source_path.



10
11
12
# File 'lib/avm/files/appendable/plain_directory.rb', line 10

def source_path
  @source_path
end

Instance Method Details

#write_on(target_dir) ⇒ Object



17
18
19
20
21
# File 'lib/avm/files/appendable/plain_directory.rb', line 17

def write_on(target_dir)
  raise "\"#{source_path}\" is not a directory" unless source_path.directory?

  ::FileUtils.cp_r("#{source_path}/.", target_dir.to_path)
end