Class: Rubyhexagon::User
- Inherits:
-
Object
- Object
- Rubyhexagon::User
- Defined in:
- lib/rubyhexagon/user.rb
Overview
Class to hold user information for users on e621.
Instance Attribute Summary collapse
-
#created_at ⇒ Time
readonly
Registration time of this user.
-
#id ⇒ Integer
readonly
Id of user.
-
#level ⇒ Level
readonly
Level of access, this user holds.
-
#name ⇒ String
readonly
Name of user.
Instance Method Summary collapse
-
#==(other) ⇒ TrueClass, FalseClass
Comparison method for User objects.
-
#initialize(user) ⇒ Object
constructor
Initializer for User.
-
#show ⇒ User
Returns a filled User object.
-
#show! ⇒ Object
Fill this object with user data.
Constructor Details
#initialize(user) ⇒ Object
Initializer for User.
46 47 48 49 |
# File 'lib/rubyhexagon/user.rb', line 46 def initialize(user) @id = user[:id].to_i @name = user[:name] end |
Instance Attribute Details
#created_at ⇒ Time (readonly)
Returns registration time of this user.
37 38 39 |
# File 'lib/rubyhexagon/user.rb', line 37 def created_at @created_at end |
#id ⇒ Integer (readonly)
Returns id of user.
28 29 30 |
# File 'lib/rubyhexagon/user.rb', line 28 def id @id end |
#level ⇒ Level (readonly)
Returns level of access, this user holds.
34 35 36 |
# File 'lib/rubyhexagon/user.rb', line 34 def level @level end |
#name ⇒ String (readonly)
Returns name of user.
31 32 33 |
# File 'lib/rubyhexagon/user.rb', line 31 def name @name end |
Instance Method Details
#==(other) ⇒ TrueClass, FalseClass
Comparison method for User objects
76 77 78 79 80 81 82 |
# File 'lib/rubyhexagon/user.rb', line 76 def ==(other) if @name.nil? other.is_a?(User) && @id == other.id else other.is_a?(User) && @id == other.id && @name == other.name end end |