From dce607a72ecc2cc5415ee025452173dc927e1b94 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 10 Oct 2015 14:24:55 +0200 Subject: Fix init of empty band. --- lib/contact.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/contact.rb') diff --git a/lib/contact.rb b/lib/contact.rb index 1e6ba4b..0d87012 100644 --- a/lib/contact.rb +++ b/lib/contact.rb @@ -1,10 +1,12 @@ class Contact attr_reader :name, :addr, :phone, :email - def initialize(params) - @name = params['name'] - @addr = params['addr'] - @phone = params['phone'] - @email = params['email'] + def initialize(params = nil) + if params + @name = params['name'] + @addr = params['addr'] + @phone = params['phone'] + @email = params['email'] + end end end -- cgit v1.2.3