Module: MediaInfo::StreamFactory
- Defined in:
- lib/media_info/stream_factory.rb
Class Method Summary collapse
Class Method Details
.create(stream_type, params) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# 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 |