class MotionAL::Representations

A collection of representations. Representations belongs to the asset.

Public Class Methods

new(asset) click to toggle source

@param asset [MotionAL::Asset]

# File lib/motional/representations.rb, line 9
def initialize(asset)
  @asset = asset
end

Public Instance Methods

each(&block)
Alias for: find_all
find_all(&block) click to toggle source

Find and enumerate representations of the asset.

@return [nil]

@yield [representation] @yieldparam representation [MotionAL::Representation] A found representation.

@example

asset.representations.find_all do |rep|
  p rep.filename
end
# File lib/motional/representations.rb, line 45
def find_all(&block)
  @asset.representation_utis.each do |uti|
    find_by_uti(uti) do |rep|
      block.call(rep)
    end
  end
end
Also aliased as: each
find_by_uti(representation_uti, &block) click to toggle source

Find a representation by a specified representation UTI.

@param representation_uti [String] A representation’s UTI @return [nil]

@yield [representation] @yieldparam representation [MotionAL::Representation] A found representation.

@example

asset.representations.find_by_uti(representation_uti) do |rep|
  p rep.filename
end
# File lib/motional/representations.rb, line 25
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