Class: MotionAL::Representations
- Inherits:
-
Object
- Object
- MotionAL::Representations
- Defined in:
- lib/motional/representations.rb
Overview
A collection of representations. Representations belongs to the asset.
Instance Method Summary collapse
-
#find_all {|representation| ... } ⇒ nil
(also: #each)
Find and enumerate representations of the asset.
-
#find_by_uti(representation_uti) {|representation| ... } ⇒ nil
Find a representation by a specified representation UTI.
-
#initialize(asset) ⇒ Representations
constructor
A new instance of Representations.
Constructor Details
#initialize(asset) ⇒ Representations
Returns a new instance of Representations.
10 11 12 |
# File 'lib/motional/representations.rb', line 10 def initialize(asset) @asset = asset end |
Instance Method Details
#find_all {|representation| ... } ⇒ nil Also known as: each
Find and enumerate representations of the asset.
46 47 48 49 50 51 52 |
# File 'lib/motional/representations.rb', line 46 def find_all(&block) @asset.representation_utis.each do |uti| find_by_uti(uti) do |rep| block.call(rep) end end end |
#find_by_uti(representation_uti) {|representation| ... } ⇒ nil
Find a representation by a specified representation UTI.
26 27 28 29 30 31 32 33 |
# File 'lib/motional/representations.rb', line 26 def find_by_uti(representation_uti, &block) al_rep = @asset.al_asset.representationForUTI(representation_uti) if al_rep block.call(Representation.new(@asset, al_rep)) else nil # not found end end |