Module MusicBrainz::Utils
In: lib/rbrainz/utils/data.rb
lib/rbrainz/utils/helper.rb

This module contains helper functions to make common tasks easier.

Methods

Public Class methods

Will return the given str extended by namespace. If str already includes the namespace or if str is empty it will be returned unchanged.

Converts an entity type constant symbol into the proper string representation

Converts an entity type string into the proper symbol

Returns a country‘s name based on an ISO-3166 country code.

The country table this function is based on has been modified for MusicBrainz purposes by using the extension mechanism defined in ISO-3166. All IDs are still valid ISO-3166 country codes, but some IDs have been added to include historic countries and some of the country names have been modified to make them better suited for display purposes.

If the country ID is not found, nil is returned. This may happen for example, when new countries are added to the MusicBrainz web service which aren‘t known to this library yet.

See:Data::COUNTRY_NAMES

Returns a language name based on an ISO-639-2/T code.

This function uses a subset of the ISO-639-2/T code table to map language IDs (terminologic, not bibliographic ones!) to names.

If the language ID is not found, nil is returned. This may happen for example, when new languages are added to the MusicBrainz web service which aren‘t known to this library yet.

See:Data::LANGUAGE_NAMES

Returns the name of a release type URI.

If the release type is not found, nil is returned. This may happen for example, when new release types are added to the MusicBrainz web service which aren‘t known to this library yet.

See:Data::RELEASE_TYPE_NAMES
See:Model::Release

Returns a script name based on an ISO-15924 code.

This function uses a subset of the ISO-15924 code table to map script IDs to names.

If the script ID is not found, nil is returned. This may happen for example, when new scripts are added to the MusicBrainz web service which aren‘t known to this library yet.

See:Data::SCRIPT_NAMES

Remove the given namespace from str. Will return str with the namespace removed. If the namespace was not present in str it will be returned unchanged.

[Validate]