Class: Avm::Files::Appendable::TemplatizedDirectory

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

Instance Method Summary collapse

Methods inherited from ResourceBase

#to_s

Instance Method Details

#applierObject

Returns:

  • (Object)


14
15
16
17
18
# File 'lib/avm/files/appendable/templatized_directory.rb', line 14

def applier
  return source_path if source_path.respond_to?(:apply)

  applier_from_path
end

#applier_from_pathEacTemplates::Variables::Directory

Returns:

  • (EacTemplates::Variables::Directory)


21
22
23
24
25
# File 'lib/avm/files/appendable/templatized_directory.rb', line 21

def applier_from_path
  raise "\"#{source_path}\" is not a directory" unless ::File.directory?(source_path)

  ::EacTemplates::Variables::Directory.new(source_path)
end

#to_s_attributesEnumerable<Symbol>

Returns:

  • (Enumerable<Symbol>)


34
35
36
# File 'lib/avm/files/appendable/templatized_directory.rb', line 34

def to_s_attributes
  [:source_path]
end

#write_on(target_dir) ⇒ Object



27
28
29
30
31
# File 'lib/avm/files/appendable/templatized_directory.rb', line 27

def write_on(target_dir)
  raise 'Variables source not set' if appender.variables_source.blank?

  applier.apply(appender.variables_source, target_dir)
end