Class: Matterhorn::Smil
- Inherits:
-
Object
- Object
- Matterhorn::Smil
- Defined in:
- lib/matterhorn/smil.rb
Overview
Matterhorn::Smil ===
Defined Under Namespace
Classes: Body, Element, Head, Par, Scene, Seq, Track
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
——————————————————————————- attributes —.
-
#head ⇒ Object
readonly
——————————————————————————- attributes —.
Instance Method Summary collapse
-
#initialize ⇒ Smil
constructor
————————————————————————— initialization —.
-
#save(smil_file) ⇒ Object
——————————————————————————— methodes —.
- #to_xml ⇒ Object
Constructor Details
#initialize ⇒ Smil
————————————————————————— initialization —
21 22 23 24 |
# File 'lib/matterhorn/smil.rb', line 21 def initialize() @head = Smil::Head.new @body = Smil::Body.new end |
Instance Attribute Details
#body ⇒ Object (readonly)
——————————————————————————- attributes —
16 17 18 |
# File 'lib/matterhorn/smil.rb', line 16 def body @body end |
#head ⇒ Object (readonly)
——————————————————————————- attributes —
16 17 18 |
# File 'lib/matterhorn/smil.rb', line 16 def head @head end |
Instance Method Details
#save(smil_file) ⇒ Object
——————————————————————————— methodes —
29 30 31 32 33 34 35 |
# File 'lib/matterhorn/smil.rb', line 29 def save(smil_file) File.open(smil_file, 'w') do |file| file.write(self.to_xml) end Rails.logger.debug { "Matterhorn::Smil::save | Smil description =\n#{self.to_xml}" } true end |
#to_xml ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/matterhorn/smil.rb', line 38 def to_xml doc = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |bx| bx.smil('xmlns' => "http://www.w3.org/ns/SMIL", 'version' => '3.0') do head.to_xml(bx) body.to_xml(bx) end end doc.to_xml.sub(/version=\"1.0\"/, "version=\"1.1\"") end |