Class: EhbrsRubyUtils::Music::LyricsBook::Song
- Inherits:
-
Resource
- Object
- Resource
- EhbrsRubyUtils::Music::LyricsBook::Song
show all
- Defined in:
- lib/ehbrs_ruby_utils/music/lyrics_book/song.rb
Constant Summary
collapse
- DEFAULT_TITLE =
'Unknown title'
Instance Attribute Summary
Attributes inherited from Resource
#previous
Instance Method Summary
collapse
Methods inherited from Resource
#<=>, create_list, #filename, #header_id, #header_index, #index_id, #link_to_header, #output_index, #output_main, #type
Instance Method Details
#album ⇒ Object
17
18
19
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 17
def album
parent
end
|
#cached_lyrics ⇒ Object
39
40
41
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 39
def cached_lyrics
::YAML.load_file(lyrics_cache.content_path)
end
|
#fs_object_id ⇒ Array<String>
22
23
24
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 22
def fs_object_id
%w[artist album title].map { |k| tag.send(k) }
end
|
43
44
45
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 43
def
"#{number} - #{title}"
end
|
#lyrics ⇒ Object
26
27
28
29
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 26
def lyrics
fetch_lyrics unless lyrics_cached?
cached_lyrics
end
|
#lyrics_cached? ⇒ Boolean
35
36
37
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 35
def lyrics_cached?
lyrics_cache.stored?
end
|
#title ⇒ Object
47
48
49
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 47
def title
tag.if_present(DEFAULT_TITLE, &:title)
end
|
#valid? ⇒ Boolean
31
32
33
|
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/song.rb', line 31
def valid?
tag.present?
end
|