Sha256: ce6c2bb57beedc9432f66473de4b5e7a8e56f816adb65f84045967e74de9f3b3

Contents?: true

Size: 746 Bytes

Versions: 13

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module Ehbrs
  module Music
    class Album
      include ::Comparable
      common_constructor :path do
        self.path = path.to_pathname.expand_path
      end

      def <=>(other)
        to_a <=> other.to_a
      end

      def to_a
        [category, artist, name]
      end

      def to_label
        (to_a + [id]).map(&:light_white).join(' | '.blue)
      end

      delegate :to_path, to: :path

      def id
        [artist, name].join('_').variableize
      end

      def name
        path.basename.to_s
      end

      def artist
        path.parent.basename.to_s
      end

      def category
        path.parent.parent.basename.to_s
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ehbrs-tools-0.29.0 lib/ehbrs/music/album.rb
ehbrs-tools-0.28.3 lib/ehbrs/music/album.rb
ehbrs-tools-0.28.2 lib/ehbrs/music/album.rb
ehbrs-tools-0.28.1 lib/ehbrs/music/album.rb
ehbrs-tools-0.28.0 lib/ehbrs/music/album.rb
ehbrs-tools-0.27.0 lib/ehbrs/music/album.rb
ehbrs-tools-0.26.0 lib/ehbrs/music/album.rb
ehbrs-tools-0.25.1 lib/ehbrs/music/album.rb
ehbrs-tools-0.25.0 lib/ehbrs/music/album.rb
ehbrs-tools-0.24.0 lib/ehbrs/music/album.rb
ehbrs-tools-0.23.1 lib/ehbrs/music/album.rb
ehbrs-tools-0.23.0 lib/ehbrs/music/album.rb
ehbrs-tools-0.22.0 lib/ehbrs/music/album.rb