Sha256: 8353f340d2d4a8b19c209274a6b16a2a4e65959b53d86b6d941388794b91da23
Contents?: true
Size: 996 Bytes
Versions: 33
Compression:
Stored size: 996 Bytes
Contents
# frozen_string_literal: true require 'ehbrs_ruby_utils/core_ext' require 'ehbrs_ruby_utils/music/lyrics_book/resource' module EhbrsRubyUtils module Music class LyricsBook class Album < ::EhbrsRubyUtils::Music::LyricsBook::Resource enable_simple_cache def book parent end def first_previous previous.if_present { |v| v.songs.last } end def valid? songs.any? end def header_title "#{songs.first.number}-#{songs.last.number} | #{artist} | #{title}" end def artist from_songs_tag(:artist) end def title from_songs_tag(:album) end private def songs_uncached ::EhbrsRubyUtils::Music::LyricsBook::Song.create_list(self, path.children) end def from_songs_tag(field) songs.lazy.map { |v| v.tag.send(field) }.find(&:present?) end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems