class Cwsrb::User
The User
class represents a member of ConWorkShop.
Attributes
@return [String] The User's bio, max 1000 characters
@return [String] The User's country
@return [String] The User's gender, one of “Male”, “Female”, “Cyborg”
or "Other"
@return [String, Integer] The User's ID
@return [Array<(Integer, Integer)>] The User's karma counts; first one
is upvotes and second one is downvotes
@return [String] The User's name
Public Class Methods
Initializes a new User
instance with an options hash. @param id [String, Integer] The user's ID: a bunch of numbers that may
or may not be prefixed with 'S'. Defaults to an empty string.
@param name [String] The user's name. Defaults to an empty string. @param gender [String] The user's gender, one of “Male”, “Female”,
"Cyborg" or "Other". Defaults to "Other".
@param bio [String] The user's bio or about section. Defaults to an
empty string.
@param country [String] The user's country. Defaults to “Unknown”. @param karma [Array<(Integer, Integer)>] The user's karma counts.
First is upvotes, second is downvotes. Defaults to zero for both.
@return [User] a new instance of User
# File lib/cwsrb/data.rb, line 38 def initialize(id: '', name: '', gender: 'Other', bio: '', country: 'Unknown', karma: [0, 0]) @id = id @name = name @gender = gender @bio = bio @country = country @karma = karma end
Public Instance Methods
Generates a CWS link to this user. @return [String] The generated link.
# File lib/cwsrb/data.rb, line 49 def generate_link CWS_BASE + "/view_profile.php?m=#{@id}" end
@overload inspect
@return [String] A more meaningful output than that of the default inspect method, with all of User's attributes.
# File lib/cwsrb/data.rb, line 56 def inspect "<User id=#{@id} name=#{@name} gender=#{gender} bio=#{bio} country=#{country} karma=#{karma}>" end