Sha256: 7f44c52b9c10b4bd7ef93325f20cabceeaf2d4355d6f50003a9f0704761a443a

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

# -*- encoding: utf-8 -*-

module MusicBrainz
  class ReleaseGroup < Base

    field :id, String
    field :type, String
    field :title, String
    field :disambiguation, String
    field :first_release_date, Time

    def releases
      @releases ||= nil
      if @releases.nil? and !id.nil?
        @releases = self.class.load({
          :parser => :release_group_releases,
          :create_models => MusicBrainz::Release
        }, {
          :resource => :release,
          :release_group => self.id,
          :inc => [:media],
          :limit => 100
        })
        @releases.sort!{ |a, b| a.date <=> b.date }
      end
      @releases
    end

    class << self
      def find(mbid)
        load({
          :parser => :release_group_model,
          :create_model => MusicBrainz::ReleaseGroup
        }, {
          :resource => :release_group,
          :id => mbid
        })
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
musicbrainz-0.7.1 lib/musicbrainz/release_group.rb
musicbrainz-0.7.0 lib/musicbrainz/release_group.rb