Class: CineSync::PlayRange
- Inherits:
-
Object
- Object
- CineSync::PlayRange
- Defined in:
- lib/cinesync/xml.rb,
lib/cinesync/play_range.rb
Instance Attribute Summary collapse
-
#in_frame ⇒ Object
Returns the value of attribute in_frame.
-
#out_frame ⇒ Object
Returns the value of attribute out_frame.
-
#play_only_range ⇒ Object
(also: #play_only_range?)
Returns the value of attribute play_only_range.
Class Method Summary collapse
Instance Method Summary collapse
- #default? ⇒ Boolean
-
#initialize ⇒ PlayRange
constructor
A new instance of PlayRange.
-
#to_xml(x) ⇒ Object
ePlayRange = element playRange { element inFrame { attribute value { tFrameNumber } } & element outFrame { attribute value { tFrameNumber } } & element playOnlyRange { aBoolValue } }.
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ PlayRange
Returns a new instance of PlayRange.
7 8 9 10 11 |
# File 'lib/cinesync/play_range.rb', line 7 def initialize @in_frame = nil @out_frame = nil @play_only_range = true end |
Instance Attribute Details
#in_frame ⇒ Object
Returns the value of attribute in_frame.
3 4 5 |
# File 'lib/cinesync/play_range.rb', line 3 def in_frame @in_frame end |
#out_frame ⇒ Object
Returns the value of attribute out_frame.
3 4 5 |
# File 'lib/cinesync/play_range.rb', line 3 def out_frame @out_frame end |
#play_only_range ⇒ Object Also known as: play_only_range?
Returns the value of attribute play_only_range.
3 4 5 |
# File 'lib/cinesync/play_range.rb', line 3 def play_only_range @play_only_range end |
Class Method Details
.load(elem) ⇒ Object
241 242 243 244 245 246 247 |
# File 'lib/cinesync/xml.rb', line 241 def self.load(elem) returning self.new do |pr| pr.in_frame = elem.elements['inFrame/attribute::value'].value.to_i pr.out_frame = elem.elements['outFrame/attribute::value'].value.to_i pr.play_only_range = elem.elements['playOnlyRange/attribute::value'].value == 'true' end end |
Instance Method Details
#default? ⇒ Boolean
13 14 15 |
# File 'lib/cinesync/play_range.rb', line 13 def default? in_frame.nil? and out_frame.nil? and play_only_range? end |
#to_xml(x) ⇒ Object
ePlayRange = element playRange {
element inFrame { attribute value { tFrameNumber } } &
element outFrame { attribute value { tFrameNumber } } &
element playOnlyRange { aBoolValue } }
229 230 231 232 233 234 235 236 237 238 |
# File 'lib/cinesync/xml.rb', line 229 def to_xml(x) fail "#{self.inspect}: Invalid" unless valid? return if default? x.playRange { x.inFrame(:value => in_frame) x.outFrame(:value => out_frame) x.playOnlyRange(:value => play_only_range?) } end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/cinesync/play_range.rb', line 17 def valid? default? or (in_frame >= 1 and out_frame >= 1 and out_frame >= in_frame) rescue false end |