Class: Matterhorn::Smil::Element

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

Overview

Matterhorn::Smil::Element ===

Direct Known Subclasses

Par, Scene, Seq, Track

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil) ⇒ Element

————————————————————————— initialization —



128
129
130
131
132
133
134
135
# File 'lib/matterhorn/smil.rb', line 128

def initialize(parent = nil)
  @start_point = nil
  @end_point   = nil
  @rel_begin   = nil
  @duration    = nil
  @scene_list  = Array.new
  @parent      = parent
end

Instance Attribute Details

#durationObject

——————————————————————————- attributes —



123
124
125
# File 'lib/matterhorn/smil.rb', line 123

def duration
  @duration
end

#end_pointObject

——————————————————————————- attributes —



123
124
125
# File 'lib/matterhorn/smil.rb', line 123

def end_point
  @end_point
end

#parentObject (readonly)

——————————————————————————- attributes —



123
124
125
# File 'lib/matterhorn/smil.rb', line 123

def parent
  @parent
end

#rel_beginObject

——————————————————————————- attributes —



123
124
125
# File 'lib/matterhorn/smil.rb', line 123

def rel_begin
  @rel_begin
end

#start_pointObject

——————————————————————————- attributes —



123
124
125
# File 'lib/matterhorn/smil.rb', line 123

def start_point
  @start_point
end

Instance Method Details

#add_scene(file, clip_begin, clip_end) ⇒ Object



152
153
154
155
156
157
# File 'lib/matterhorn/smil.rb', line 152

def add_scene(file, clip_begin, clip_end)
  scene = Smil::Scene.new(self, file, clip_begin, clip_end)
  @scene_list.sort! { |a, b| a.clip_begin <=> b.clip_begin }
  @scene_list << scene
  scene
end

#attr_listObject

——————————————————————————— methodes —



140
141
142
143
144
145
146
147
148
149
# File 'lib/matterhorn/smil.rb', line 140

def attr_list
  attr_list = Hash.new
  if !@rel_begin.nil?
    attr_list[:begin] = "#{(@rel_begin * 1000).round.to_s}ms"
  end
  if !@duration.nil?
    attr_list[:dur] = "#{(@duration * 1000).round.to_s}ms"
  end
  attr_list
end