Sha256: 1dc1e0f2f260a98150c4c420d4cf0644084cfff2dca1290d1b908ae7d2b20651
Contents?: true
Size: 814 Bytes
Versions: 11
Compression:
Stored size: 814 Bytes
Contents
require 'yt/annotations/card' module Yt module Annotations # A Featured annotation is similar to a card, except that it displays in # the bottom-left corner and only shows if no cards are present. class Featured < Card private def text_in(json) json.values_at('text_line_1', 'text_line_2').join(': ') end def ends_at_in(data) data['end_ms'] / 1000.0 end def to_link(data, json) return unless url = data.fetch('action', {})['url'] new_window = url['target'] != 'current' {url: url['value'], new_window: new_window, type: link_type(json)} end def link_type(json) if json['playlist_length'] :playlist elsif json['video_duration'] :video end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems