Created
January 13, 2016 17:54
-
-
Save krokrob/201d397c29681ac0be5a to your computer and use it in GitHub Desktop.
This file contains 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 FacebookUser | |
attr_reader :email, :friends | |
def initialize(options = {}) | |
@name = options[:name] | |
@age = options[:age] | |
@inscription_date = Time.now | |
@email = options[:email] | |
@password = options[:password] | |
@photos = [] | |
@friends = [] | |
end | |
def add_photo(photo_url) | |
@photos << photo_url | |
end | |
def to_s | |
return "#{@name}: #{@photos.count} photos" | |
end | |
def password | |
return '*************' | |
end | |
def add_friend(friend) | |
#if friend.class == FacebookUser | |
@friends << friend | |
friend.add_friend(self) unless friend.friends.include?(self) | |
#end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment