Class: RakeMKV::Titles

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rakemkv/titles.rb

Overview

Titles

Instance Method Summary collapse

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

#longestObject

Get longest title



19
20
21
# File 'lib/rakemkv/titles.rb', line 19

def longest
  max { |a, b| a.time <=> b.time }
end