Class: Xcplayground::XctimelineFile
- Inherits:
-
Object
- Object
- Xcplayground::XctimelineFile
- Defined in:
- lib/xcplayground/xctimeline_file.rb
Overview
Represent a .xctimeline file on disc
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(filename = 'timeline.xctimeline', version = '3.0') ⇒ XctimelineFile
constructor
A new instance of XctimelineFile.
- #save(path) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(filename = 'timeline.xctimeline', version = '3.0') ⇒ XctimelineFile
Returns a new instance of XctimelineFile.
9 10 11 12 |
# File 'lib/xcplayground/xctimeline_file.rb', line 9 def initialize(filename = 'timeline.xctimeline', version = '3.0') @filename = filename @version = version end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/xcplayground/xctimeline_file.rb', line 6 def filename @filename end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
7 8 9 |
# File 'lib/xcplayground/xctimeline_file.rb', line 7 def version @version end |
Instance Method Details
#save(path) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/xcplayground/xctimeline_file.rb', line 14 def save(path) file = File.join(path, filename) File.open(file, 'w') do |f| f.puts to_s end end |
#to_s ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/xcplayground/xctimeline_file.rb', line 21 def to_s xml = Builder::XmlMarkup.new(indent: 2) xml.instruct! :xml, version: '1.0', encoding: 'UTF-8' xml.Timeline(version: version) do |tl| tl.TimelineItems {} end xml.target! end |