Skip to content

Instantly share code, notes, and snippets.

@krokrob
Created January 13, 2016 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krokrob/201d397c29681ac0be5a to your computer and use it in GitHub Desktop.
Save krokrob/201d397c29681ac0be5a to your computer and use it in GitHub Desktop.
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