Class: M3u8::KeyItem

Inherits:
Object
  • Object
show all
Extended by:
M3u8
Includes:
Encryptable
Defined in:
lib/m3u8/key_item.rb

Overview

KeyItem represents a set of EXT-X-KEY attributes

Constant Summary

Constants included from M3u8

VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods included from M3u8

intialize_with_byterange, parse_attributes, parse_float, parse_yes_no, to_yes_no

Methods included from Encryptable

#attributes_to_s, #convert_key_names, included

Constructor Details

#initialize(params = {}) ⇒ KeyItem

Returns a new instance of KeyItem.



8
9
10
11
12
13
# File 'lib/m3u8/key_item.rb', line 8

def initialize(params = {})
  options = convert_key_names(params)
  options.merge(params).each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Class Method Details

.parse(text) ⇒ Object



15
16
17
18
# File 'lib/m3u8/key_item.rb', line 15

def self.parse(text)
  attributes = parse_attributes(text)
  KeyItem.new(attributes)
end

Instance Method Details

#to_sObject



20
21
22
# File 'lib/m3u8/key_item.rb', line 20

def to_s
  "#EXT-X-KEY:#{attributes_to_s}"
end