Class: Cwsrb::User
- Inherits:
-
Object
- Object
- Cwsrb::User
- Defined in:
- lib/cwsrb/data.rb
Overview
The User class represents a member of ConWorkShop.
Instance Attribute Summary collapse
-
#bio ⇒ String
readonly
The User's bio, max 1000 characters.
-
#country ⇒ String
readonly
The User's country.
-
#gender ⇒ String
readonly
The User's gender, one of "Male", "Female", "Cyborg" or "Other".
-
#id ⇒ String, Integer
readonly
The User's ID.
-
#karma ⇒ Array<(Integer, Integer)>
readonly
The User's karma counts; first one is upvotes and second one is downvotes.
-
#name ⇒ String
readonly
The User's name.
Instance Method Summary collapse
-
#initialize(id: nil, name: nil, gender: 'Other', bio: '', country: 'Unknown', karma: [0, 0]) ⇒ User
constructor
Initializes a new User instance with an options hash.
- #inspect ⇒ String
Constructor Details
#initialize(id: nil, name: nil, gender: 'Other', bio: '', country: 'Unknown', karma: [0, 0]) ⇒ User
Initializes a new User instance with an options hash.
30 31 32 33 34 35 36 37 |
# File 'lib/cwsrb/data.rb', line 30 def initialize(id: nil, name: nil, gender: 'Other', bio: '', country: 'Unknown', karma: [0, 0]) @id = id @name = name @gender = gender @bio = bio @country = country @karma = karma end |
Instance Attribute Details
#bio ⇒ String (readonly)
Returns The User's bio, max 1000 characters.
14 15 16 |
# File 'lib/cwsrb/data.rb', line 14 def bio @bio end |
#country ⇒ String (readonly)
Returns The User's country.
17 18 19 |
# File 'lib/cwsrb/data.rb', line 17 def country @country end |
#gender ⇒ String (readonly)
Returns The User's gender, one of "Male", "Female", "Cyborg" or "Other".
11 12 13 |
# File 'lib/cwsrb/data.rb', line 11 def gender @gender end |
#id ⇒ String, Integer (readonly)
Returns The User's ID.
5 6 7 |
# File 'lib/cwsrb/data.rb', line 5 def id @id end |
#karma ⇒ Array<(Integer, Integer)> (readonly)
Returns The User's karma counts; first one is upvotes and second one is downvotes.
20 21 22 |
# File 'lib/cwsrb/data.rb', line 20 def karma @karma end |
#name ⇒ String (readonly)
Returns The User's name.
8 9 10 |
# File 'lib/cwsrb/data.rb', line 8 def name @name end |
Instance Method Details
#inspect ⇒ String
41 42 43 |
# File 'lib/cwsrb/data.rb', line 41 def inspect "<User id=#{@id} name=#{@name} gender=#{gender} bio=#{bio} country=#{country} karma=#{karma}>" end |