Module: M3u8::Encryptable

Included in:
KeyItem, SessionKeyItem
Defined in:
lib/m3u8/encryptable.rb

Overview

Encapsulates logic common to encryption key tags

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/m3u8/encryptable.rb', line 5

def self.included(base)
  base.send :attr_accessor, :method
  base.send :attr_accessor, :uri
  base.send :attr_accessor, :iv
  base.send :attr_accessor, :key_format
  base.send :attr_accessor, :key_format_versions
end

Instance Method Details

#attributes_to_sObject



13
14
15
16
17
18
19
# File 'lib/m3u8/encryptable.rb', line 13

def attributes_to_s
  [method_format,
   uri_format,
   iv_format,
   key_format_format,
   key_format_versions_format].compact.join(',')
end

#convert_key_names(attributes) ⇒ Object



21
22
23
24
25
# File 'lib/m3u8/encryptable.rb', line 21

def convert_key_names(attributes)
  { method: attributes['METHOD'], uri: attributes['URI'],
    iv: attributes['IV'], key_format: attributes['KEYFORMAT'],
    key_format_versions: attributes['KEYFORMATVERSIONS'] }
end