Class: Yt::Models::Caption
- Defined in:
- lib/yt/models/caption.rb
Overview
Provides methods to interact with YouTube video captions.
Constant Summary
Constants inherited from Resource
Resource::CHANNEL_PATTERNS, Resource::PLAYLIST_PATTERNS, Resource::VIDEO_PATTERNS
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#download(path) ⇒ Object
Downloads a caption file.
-
#id ⇒ String
The ID used to identify the caption.
- #io ⇒ Object
Methods inherited from Resource
#private?, #public?, #unlisted?
Instance Method Details
#download(path) ⇒ Object
Downloads a caption file.
22 23 24 25 26 27 |
# File 'lib/yt/models/caption.rb', line 22 def download(path) case io when StringIO then File.open(path, 'w') { |f| f.write(io.read) } when Tempfile then io.close; FileUtils.mv(io.path, path) end end |
#id ⇒ String
Returns the ID used to identify the caption.
11 |
# File 'lib/yt/models/caption.rb', line 11 has_attribute :id |
#io ⇒ Object
29 30 31 |
# File 'lib/yt/models/caption.rb', line 29 def io @io ||= get_request(download_params).open_uri end |