Class: Discordrb::Role
- Inherits:
-
Object
- Object
- Discordrb::Role
- Defined in:
- lib/discordrb/data.rb
Overview
A Discord role that contains permissions and applies to certain users
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#hoist ⇒ Object
readonly
Returns the value of attribute hoist.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
Instance Method Summary collapse
-
#initialize(data, bot, server = nil) ⇒ Role
constructor
A new instance of Role.
- #update_from(other) ⇒ Object
Constructor Details
#initialize(data, bot, server = nil) ⇒ Role
Returns a new instance of Role.
125 126 127 128 129 130 131 132 133 |
# File 'lib/discordrb/data.rb', line 125 def initialize(data, bot, server = nil) @bot = bot @server = server @permissions = Permissions.new(data['permissions']) @name = data['name'] @id = data['id'].to_i @hoist = data['hoist'] @color = ColorRGB.new(data['color']) end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
123 124 125 |
# File 'lib/discordrb/data.rb', line 123 def color @color end |
#hoist ⇒ Object (readonly)
Returns the value of attribute hoist.
122 123 124 |
# File 'lib/discordrb/data.rb', line 122 def hoist @hoist end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
121 122 123 |
# File 'lib/discordrb/data.rb', line 121 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
120 121 122 |
# File 'lib/discordrb/data.rb', line 120 def name @name end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
119 120 121 |
# File 'lib/discordrb/data.rb', line 119 def @permissions end |
Instance Method Details
#update_from(other) ⇒ Object
135 136 137 138 139 140 |
# File 'lib/discordrb/data.rb', line 135 def update_from(other) @permissions = other. @name = other.name @hoist = other.hoist @color = other.color end |