Module: MusicBrainz::Configurable

Included in:
MusicBrainz
Defined in:
lib/musicbrainz/configuration.rb

Instance Method Summary collapse

Instance Method Details

#apply_test_configuration!Object


52
53
54
55
56
57
58
# File 'lib/musicbrainz/configuration.rb', line 52

def apply_test_configuration!
  configure do |c|
    c.app_name = "gem musicbrainz (development mode)"
    c.app_version = MusicBrainz::VERSION
    c.contact = `git config user.email`.chomp
  end
end

#configObject

Raises:

  • (Exception)

47
48
49
50
# File 'lib/musicbrainz/configuration.rb', line 47

def config
  raise Exception.new("Configuration missing") unless instance_variable_defined?(:@config)
  @config
end

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

Yields:

Raises:

  • (Exception)

41
42
43
44
45
# File 'lib/musicbrainz/configuration.rb', line 41

def configure
  raise Exception.new("Configuration block missing") unless block_given?
  yield @config ||= MusicBrainz::Configuration.new
  config.valid?
end