Class: RakeMKV::Titles
- Inherits:
-
Object
- Object
- RakeMKV::Titles
- Includes:
- Enumerable
- Defined in:
- lib/rakemkv/titles.rb
Overview
Titles
Instance Method Summary collapse
-
#at_id(id) ⇒ Object
Find title by id.
- #each(&block) ⇒ Object
-
#initialize(titles) ⇒ Titles
constructor
A new instance of Titles.
-
#longest ⇒ Object
Get longest title.
Constructor Details
#initialize(titles) ⇒ Titles
Returns a new instance of Titles.
5 6 7 |
# File 'lib/rakemkv/titles.rb', line 5 def initialize(titles) @titles = titles end |
Instance Method Details
#at_id(id) ⇒ Object
Find title by id
14 15 16 |
# File 'lib/rakemkv/titles.rb', line 14 def at_id(id) detect { |title| title.id == id } end |
#each(&block) ⇒ Object
9 10 11 |
# File 'lib/rakemkv/titles.rb', line 9 def each(&block) @titles.each(&block) end |
#longest ⇒ Object
Get longest title
19 20 21 |
# File 'lib/rakemkv/titles.rb', line 19 def longest max { |a, b| a.time <=> b.time } end |