Class: Yt::Annotations::Note

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/annotations/note.rb

Overview

A Note annotation is just a basic annotation with text, start/end time and an optional link. It's shaped like a Post-It with a curved corner.

Direct Known Subclasses

Label, Speech, Spotlight, Title

Instance Attribute Summary

Attributes inherited from Base

#ends_at, #link, #starts_at, #text

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Note


10
11
12
13
14
15
# File 'lib/yt/annotations/note.rb', line 10

def initialize(data = {})
  @text = data['TEXT']
  @starts_at = to_seconds regions_of(data)[0]['t']
  @ends_at = to_seconds regions_of(data)[1]['t']
  @link = to_link data.fetch('action', {})['url']
end