Module: Musicz

Defined in:
lib/musicz.rb,
lib/musicz/types.rb,
lib/musicz/entity.rb,
lib/musicz/request.rb,
lib/musicz/version.rb,
lib/musicz/entities/tag.rb,
lib/musicz/configuration.rb,
lib/musicz/entities/area.rb,
lib/musicz/entities/alias.rb,
lib/musicz/entities/error.rb,
lib/musicz/entities/media.rb,
lib/musicz/entities/track.rb,
lib/musicz/entities/artist.rb,
lib/musicz/entities/rating.rb,
lib/musicz/entities/disc_id.rb,
lib/musicz/entities/release.rb,
lib/musicz/search/repository.rb,
lib/musicz/entities/life_span.rb,
lib/musicz/entities/recording.rb,
lib/musicz/entities/artist_list.rb,
lib/musicz/entities/area_relation.rb,
lib/musicz/entities/artist_credit.rb,
lib/musicz/entities/release_event.rb,
lib/musicz/entities/release_group.rb,
lib/musicz/search/area_repository.rb,
lib/musicz/entities/area_reference.rb,
lib/musicz/entities/recording_list.rb,
lib/musicz/search/artist_repository.rb,
lib/musicz/search/options/id_search.rb,
lib/musicz/entities/artist_reference.rb,
lib/musicz/entities/release_reference.rb,
lib/musicz/search/recording_repository.rb,
lib/musicz/entities/recording_reference.rb,
lib/musicz/entities/text_representation.rb,
lib/musicz/entities/label_info_reference.rb,
lib/musicz/search/options/artist_query_terms.rb,
lib/musicz/search/options/recording_query_terms.rb

Defined Under Namespace

Modules: Entities, Search, Types Classes: Configuration, Entity, Error, Request

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.clearObject



36
37
38
# File 'lib/musicz/configuration.rb', line 36

def self.clear
  @config = nil
end

.configObject



40
41
42
# File 'lib/musicz/configuration.rb', line 40

def self.config
  @config
end

.config=(value) ⇒ Object

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
# File 'lib/musicz/configuration.rb', line 44

def self.config=(value)
  unless value.is_a?(Configuration)
    raise ArgumentError, "value is not a Configuration object"
  end

  raise ArgumentError, "invalid Configuration value" unless value.valid?

  @config = value
end

.configure {|@config ||= Configuration.new| ... } ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/musicz/configuration.rb', line 54

def self.configure
  raise Configuration::NoConfigBlockGiven unless block_given?

  yield @config ||= Configuration.new
  return if @config.valid?

  raise Configuration::InvalidConfiguration, @config.errors
end