Class: M3u8::MediaItem
- Inherits:
-
Object
- Object
- M3u8::MediaItem
- Extended by:
- M3u8
- Defined in:
- lib/m3u8/media_item.rb
Overview
MediaItem represents a set of EXT-X-MEDIA attributes
Constant Summary
Constants included from M3u8
Instance Attribute Summary collapse
-
#assoc_language ⇒ Object
Returns the value of attribute assoc_language.
-
#autoselect ⇒ Object
Returns the value of attribute autoselect.
-
#channels ⇒ Object
Returns the value of attribute channels.
-
#characteristics ⇒ Object
Returns the value of attribute characteristics.
-
#default ⇒ Object
Returns the value of attribute default.
-
#forced ⇒ Object
Returns the value of attribute forced.
-
#group_id ⇒ Object
Returns the value of attribute group_id.
-
#instream_id ⇒ Object
Returns the value of attribute instream_id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ MediaItem
constructor
A new instance of MediaItem.
- #to_s ⇒ Object
Methods included from M3u8
intialize_with_byterange, parse_attributes, parse_float, parse_yes_no
Constructor Details
#initialize(params = {}) ⇒ MediaItem
Returns a new instance of MediaItem.
10 11 12 13 14 |
# File 'lib/m3u8/media_item.rb', line 10 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#assoc_language ⇒ Object
Returns the value of attribute assoc_language.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def assoc_language @assoc_language end |
#autoselect ⇒ Object
Returns the value of attribute autoselect.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def autoselect @autoselect end |
#channels ⇒ Object
Returns the value of attribute channels.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def channels @channels end |
#characteristics ⇒ Object
Returns the value of attribute characteristics.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def characteristics @characteristics end |
#default ⇒ Object
Returns the value of attribute default.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def default @default end |
#forced ⇒ Object
Returns the value of attribute forced.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def forced @forced end |
#group_id ⇒ Object
Returns the value of attribute group_id.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def group_id @group_id end |
#instream_id ⇒ Object
Returns the value of attribute instream_id.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def instream_id @instream_id end |
#language ⇒ Object
Returns the value of attribute language.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def language @language end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def type @type end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/m3u8/media_item.rb', line 6 def uri @uri end |
Class Method Details
.parse(text) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/m3u8/media_item.rb', line 16 def self.parse(text) attributes = parse_attributes(text) = { type: attributes['TYPE'], group_id: attributes['GROUP-ID'], language: attributes['LANGUAGE'], assoc_language: attributes['ASSOC-LANGUAGE'], name: attributes['NAME'], autoselect: parse_yes_no(attributes['AUTOSELECT']), default: parse_yes_no(attributes['DEFAULT']), forced: parse_yes_no(attributes['FORCED']), uri: attributes['URI'], instream_id: attributes['INSTREAM-ID'], characteristics: attributes['CHARACTERISTICS'], channels: attributes['CHANNELS'] } MediaItem.new() end |
Instance Method Details
#to_s ⇒ Object
32 33 34 |
# File 'lib/m3u8/media_item.rb', line 32 def to_s "#EXT-X-MEDIA:#{formatted_attributes.join(',')}" end |