Class: FinalCutPro::XMLParser::FCPXML::Version1

Inherits:
Common
  • Object
show all
Defined in:
lib/final_cut_pro/xml_parser/fcpxml/version_1.rb

Instance Attribute Summary

Attributes inherited from Common

#files, #logger, #sequences

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Common

#initialize, #is_clip?, #is_fcpxml?, #is_project?, #is_sequence?, #is_xmeml?, #root, #root_type, #to_hash, #top_level_container, #version, xml_as_document, #xml_as_document, #xml_document, #xml_node_to_hash

Constructor Details

This class inherits a constructor from FinalCutPro::XMLParser::Common

Class Method Details

.parse(xml, params = {}) ⇒ Object



8
9
10
11
# File 'lib/final_cut_pro/xml_parser/fcpxml/version_1.rb', line 8

def self.parse(xml, params = {})
  parser = new(xml)
  parser.parse(parser.xml_document, params)
end

Instance Method Details

#parse(xml = @xml_document, options = { }) ⇒ Object

self.parse



13
14
15
16
# File 'lib/final_cut_pro/xml_parser/fcpxml/version_1.rb', line 13

def parse(xml = @xml_document, options = { })
  @files = parse_files(xml, options)
  return self
end

#parse_files(xml = @xml_document, options = { }) ⇒ Object

parse



18
19
20
21
22
23
# File 'lib/final_cut_pro/xml_parser/fcpxml/version_1.rb', line 18

def parse_files(xml = @xml_document, options = { })
  xml.find('//asset').map do |asset_node|
    hash = xml_node_to_hash(asset_node)
    hash.merge!({ :path_on_file_system => CGI::unescape(URI(hash[:src]).path) })
  end
end