module MediaInfo::StreamFactory

Public Class Methods

create(stream_type, params) click to toggle source
# File lib/media_info/stream_factory.rb, line 11
def self.create(stream_type, params)
  raise ArgumentError, "Need a stream_type, received #{stream_type.inspect}" if stream_type.nil?

  # we check that there is a subclass of stream for this stream
  stream_class_name = "MediaInfo::#{stream_type}Stream"
  raise "Bad stream type: #{stream_type.inspect}" unless Object.const_defined?(stream_class_name)

  Object.const_get(stream_class_name).new(params)
end