Class: Discordrb::Team::Member
- Inherits:
-
Object
- Object
- Discordrb::Team::Member
- Defined in:
- lib/discordrb/data/team.rb
Overview
A member that has been invited to a team.
Instance Attribute Summary collapse
-
#role ⇒ Symbol
readonly
The role of this team member.
-
#state ⇒ Integer
readonly
The membership state of this team member.
-
#team ⇒ Team
readonly
The team this member is a part of.
-
#user ⇒ Integer
readonly
The user associated with this team member.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
(also: #eql?)
Comparison based off of user ID and team ID.
-
#admin? ⇒ true, false
Whether this team member is an admin.
-
#developer? ⇒ true, false
Whether this team member is a developer.
-
#owner? ⇒ true, false
Whether this team member is the owner of the team.
-
#pending? ⇒ true, false
Whether this team member has been invited to the team, but hasn't accepted the invite yet.
-
#read_only? ⇒ true, false
Whether this team member is a read only developer.
Instance Attribute Details
#role ⇒ Symbol (readonly)
Returns the role of this team member.
41 42 43 |
# File 'lib/discordrb/data/team.rb', line 41 def role @role end |
#state ⇒ Integer (readonly)
Returns the membership state of this team member.
47 48 49 |
# File 'lib/discordrb/data/team.rb', line 47 def state @state end |
#team ⇒ Team (readonly)
Returns the team this member is a part of.
44 45 46 |
# File 'lib/discordrb/data/team.rb', line 44 def team @team end |
#user ⇒ Integer (readonly)
Returns the user associated with this team member.
50 51 52 |
# File 'lib/discordrb/data/team.rb', line 50 def user @user end |
Instance Method Details
#==(other) ⇒ true, false Also known as: eql?
Comparison based off of user ID and team ID.
87 88 89 90 91 92 93 |
# File 'lib/discordrb/data/team.rb', line 87 def ==(other) return false unless other.is_a?(Member) return false unless @team == other.team Discordrb.id_compare?(other.user.id, @user.id) end |
#admin? ⇒ true, false
Returns whether this team member is an admin.
79 80 81 82 83 |
# File 'lib/discordrb/data/team.rb', line 79 %i[admin developer read_only].each do |role| define_method("#{role}?") do @role == role end end |
#developer? ⇒ true, false
Returns whether this team member is a developer.
79 80 81 82 83 |
# File 'lib/discordrb/data/team.rb', line 79 %i[admin developer read_only].each do |role| define_method("#{role}?") do @role == role end end |
#owner? ⇒ true, false
Whether this team member is the owner of the team.
69 70 71 |
# File 'lib/discordrb/data/team.rb', line 69 def owner? @team.owner == self end |
#pending? ⇒ true, false
Whether this team member has been invited to the team, but hasn't accepted the invite yet.
63 64 65 |
# File 'lib/discordrb/data/team.rb', line 63 def pending? @state == 1 end |
#read_only? ⇒ true, false
Returns whether this team member is a read only developer.
79 80 81 82 83 |
# File 'lib/discordrb/data/team.rb', line 79 %i[admin developer read_only].each do |role| define_method("#{role}?") do @role == role end end |