Class: User
- Inherits:
-
Object
- Object
- User
- Defined in:
- lib/model/user.rb
Instance Attribute Summary collapse
-
#bio ⇒ Object
readonly
Returns the value of attribute bio.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#posts ⇒ Object
readonly
Returns the value of attribute posts.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #add_post(post) ⇒ Object
-
#initialize(name, username, user_id, bio) ⇒ User
constructor
A new instance of User.
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
#bio ⇒ Object (readonly)
Returns the value of attribute bio.
3 4 5 |
# File 'lib/model/user.rb', line 3 def bio @bio end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/model/user.rb', line 3 def name @name end |
#posts ⇒ Object (readonly)
Returns the value of attribute posts.
3 4 5 |
# File 'lib/model/user.rb', line 3 def posts @posts end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
3 4 5 |
# File 'lib/model/user.rb', line 3 def user_id @user_id end |
#username ⇒ Object (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 |