Class: User

Inherits:
Object
  • Object
show all
Defined in:
lib/model/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, username, user_id, bio) ⇒ User

Returns a new instance of User.



5
6
7
8
9
10
11
# File 'lib/model/user.rb', line 5

def initialize(name, username, user_id, bio)
  @name = name
  @username = username
  @user_id = user_id
  @bio = bio
  @posts = []
end

Instance Attribute Details

#bioObject (readonly)

Returns the value of attribute bio.



3
4
5
# File 'lib/model/user.rb', line 3

def bio
  @bio
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/model/user.rb', line 3

def name
  @name
end

#postsObject (readonly)

Returns the value of attribute posts.



3
4
5
# File 'lib/model/user.rb', line 3

def posts
  @posts
end

#user_idObject (readonly)

Returns the value of attribute user_id.



3
4
5
# File 'lib/model/user.rb', line 3

def user_id
  @user_id
end

#usernameObject (readonly)

Returns the value of attribute username.



3
4
5
# File 'lib/model/user.rb', line 3

def username
  @username
end

Instance Method Details

#add_post(post) ⇒ Object



13
14
15
# File 'lib/model/user.rb', line 13

def add_post(post)
  @posts << post
end