summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/band.rb39
1 files changed, 21 insertions, 18 deletions
diff --git a/lib/band.rb b/lib/band.rb
index ac0a9db..61efcee 100644
--- a/lib/band.rb
+++ b/lib/band.rb
@@ -6,27 +6,30 @@ class Band
attr_reader :name, :city, :website, :label, :short_bio, :contact, :members, :songs
attr_reader :errors
- def initialize(params)
+ def initialize(params = nil)
@errors = []
- @name = params['name']
- @city = params['city']
- @website = params['website']
- @label = params['label']
- @short_bio = params['shortbio']
-
- @contact = Contact.new(params['contact'])
-
- @members = []
- if params['members']
- params['members'].each do |k, m|
- @members << Member.new(m)
+
+ if params
+ @name = params['name']
+ @city = params['city']
+ @website = params['website']
+ @label = params['label']
+ @short_bio = params['shortbio']
+
+ @contact = Contact.new(params['contact'])
+
+ @members = []
+ if params['members']
+ params['members'].each do |k, m|
+ @members << Member.new(m)
+ end
end
- end
- @songs = []
- if params['songs']
- params['songs'].each do |k, s|
- @songs << Song.new(s)
+ @songs = []
+ if params['songs']
+ params['songs'].each do |k, s|
+ @songs << Song.new(s)
+ end
end
end
end