Sha256: e99b9b2339dfe4fa6e98390b96de2678b1b12f87579af930703f18cd8e670f21

Contents?: true

Size: 922 Bytes

Versions: 15

Compression:

Stored size: 922 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
          songs.lazy.map { |v| v.tag.artist }.find(&:present?)
        end

        def title
          songs.lazy.map { |v| v.tag.album }.find(&:present?)
        end

        def songs_uncached
          ::EhbrsRubyUtils::Music::LyricsBook::Song.create_list(self, path.children)
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
ehbrs_ruby_utils-0.17.2 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.17.1 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.17.0 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.16.1 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.16.0 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.15.0 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.14.0 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.13.0 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.12.2 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs-tools-0.28.3 vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.12.1 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs-tools-0.28.2 vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs-tools-0.28.1 vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs_ruby_utils-0.12.0 lib/ehbrs_ruby_utils/music/lyrics_book/album.rb
ehbrs-tools-0.28.0 vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb