Class: Musicz::Configuration
- Inherits:
-
Object
- Object
- Musicz::Configuration
- Defined in:
- lib/musicz/configuration.rb
Defined Under Namespace
Classes: InvalidConfiguration, NoConfigBlockGiven
Constant Summary collapse
- DEFAULT_BASE_URI =
"https://musicbrainz.org/ws/2"
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#contact ⇒ Object
Returns the value of attribute contact.
Class Method Summary collapse
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(base_uri: DEFAULT_BASE_URI) ⇒ Configuration
constructor
A new instance of Configuration.
- #valid? ⇒ Boolean
Constructor Details
#initialize(base_uri: DEFAULT_BASE_URI) ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 |
# File 'lib/musicz/configuration.rb', line 12 def initialize(base_uri: DEFAULT_BASE_URI) @base_uri = base_uri end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
10 11 12 |
# File 'lib/musicz/configuration.rb', line 10 def app_name @app_name end |
#base_uri ⇒ Object
Returns the value of attribute base_uri.
10 11 12 |
# File 'lib/musicz/configuration.rb', line 10 def base_uri @base_uri end |
#contact ⇒ Object
Returns the value of attribute contact.
10 11 12 |
# File 'lib/musicz/configuration.rb', line 10 def contact @contact end |
Class Method Details
.build_default ⇒ Object
28 29 30 31 32 33 |
# File 'lib/musicz/configuration.rb', line 28 def self.build_default new.tap do |c| c.app_name = "Musicz" c.contact = "https://github.com/derrickp/musicz" end end |
Instance Method Details
#errors ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/musicz/configuration.rb', line 20 def errors [].tap do |arr| arr << "No base_uri" if base_uri.nil? arr << "No app_name" if app_name.nil? arr << "No contact" if contact.nil? end end |
#valid? ⇒ Boolean
16 17 18 |
# File 'lib/musicz/configuration.rb', line 16 def valid? errors.empty? end |