Last active
December 17, 2015 00:18
-
-
Save BrayanZ/5519590 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
def initialize name, user_information={} | |
@name = name | |
@phone_number = user_information[:phone_number] | |
end | |
def name | |
return @name | |
end | |
def phone_number | |
phone_number.to_s | |
end | |
end | |
user = User.new 'Brayan' | |
if user.phone_number.nil? | |
puts 'No phone number provided.' | |
else | |
puts user.phone_number | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment