Sha256: 9f2435270634d2dfbb42ae986ddd6ad81fc173524d462fb18f62089f25e771e7

Contents?: true

Size: 517 Bytes

Versions: 4

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true
module M3u8
  # KeyItem represents a set of EXT-X-KEY attributes
  class KeyItem
    include Encryptable
    extend M3u8

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
m3u8-0.8.2 lib/m3u8/key_item.rb
m3u8-0.8.1 lib/m3u8/key_item.rb
m3u8-0.8.0 lib/m3u8/key_item.rb
m3u8-0.7.1 lib/m3u8/key_item.rb