Class: FileTemplateExporter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_template) ⇒ FileTemplateExporter

Returns a new instance of FileTemplateExporter.



6
7
8
9
# File 'lib/file_template_exporter.rb', line 6

def initialize(file_template)
  @file_template = file_template
  @filename = "TemplateInfo.plist"
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



4
5
6
# File 'lib/file_template_exporter.rb', line 4

def filename
  @filename
end

Instance Method Details

#to_xmlObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/file_template_exporter.rb', line 11

def to_xml
  file_template = EmptyTemplate.read("file_template")
  file_template.gsub!("{{IDENTIFIER}}", @file_template.identifier)
  file_definitions_to_xml = file_definitions.collect do |file_definition|
    file_definition_to_xml(file_definition)
  end.join("\n")
  file_template.gsub!("{{FILE_DEFINITIONS}}", file_definitions_to_xml)
  file_template.gsub!("{{FILE_DEFINITIONS_LIST}}", file_definition_list_as_xml)
  file_template
end