Class: Discordrb::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot, server = nil) ⇒ Role

Returns a new instance of Role.



126
127
128
129
130
131
132
# File 'lib/discordrb/data.rb', line 126

def initialize(data, bot, server = nil)
  @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

#colorObject (readonly)

Returns the value of attribute color.



124
125
126
# File 'lib/discordrb/data.rb', line 124

def color
  @color
end

#hoistObject (readonly)

Returns the value of attribute hoist.



123
124
125
# File 'lib/discordrb/data.rb', line 123

def hoist
  @hoist
end

#idObject (readonly)

Returns the value of attribute id.



122
123
124
# File 'lib/discordrb/data.rb', line 122

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



121
122
123
# File 'lib/discordrb/data.rb', line 121

def name
  @name
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



120
121
122
# File 'lib/discordrb/data.rb', line 120

def permissions
  @permissions
end

Instance Method Details

#update_from(other) ⇒ Object



134
135
136
137
138
139
# File 'lib/discordrb/data.rb', line 134

def update_from(other)
  @permissions = other.permissions
  @name = other.name
  @hoist = other.hoist
  @color = other.color
end