summaryrefslogtreecommitdiffstats
path: root/lib/member.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/member.rb')
-rw-r--r--lib/member.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/member.rb b/lib/member.rb
index 0fb69b5..598b5f4 100644
--- a/lib/member.rb
+++ b/lib/member.rb
@@ -1,10 +1,16 @@
class Member
attr_reader :name, :instrument, :age
- def initialize(params)
- @name = params['name']
- @instrument = params['instrument']
- @age = params['age'].to_i
+ def initialize(params = nil)
+ if params
+ @name = params['name']
+ @instrument = params['instrument']
+ @age = params['age'].to_i
+ else
+ @name = ''
+ @instrument = ''
+ @age = 0
+ end
end
def to_s