The expression new_data[:permission_overwrites].map { |_, v| v.to_hash } is present here, which I infer assumes new_data[:permission_overwrites] is a Hash (or something else that can be destructured into pairs). However, this makes no sense semantically, since the relevant Discord API endpoint (PATCH /channels/{channel.id}) takes an array of permission overwrite objects.
Summary
Here's the documentation for
Channel#permission_overwrites=
(as rendered by YARD):When I try to call the method as documented (
channel.permission_overwrites = [ow1, ow2]
), I get a stack trace like the following:This is because the implementation of this method doesn't match the docs. Here's the code for that method:
https://github.com/shardlab/discordrb/blob/a873d4efad8e87af5732a7e63044ff95cebc11d6/lib/discordrb/data/channel.rb#L345-L347
Here's the code for the method it calls:
https://github.com/shardlab/discordrb/blob/a873d4efad8e87af5732a7e63044ff95cebc11d6/lib/discordrb/data/channel.rb#L965-L980
The expression
new_data[:permission_overwrites].map { |_, v| v.to_hash }
is present here, which I infer assumesnew_data[:permission_overwrites]
is aHash
(or something else that can be destructured into pairs). However, this makes no sense semantically, since the relevant Discord API endpoint (PATCH/channels/{channel.id}
) takes an array of permission overwrite objects.Environment
Ruby version:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [aarch64-linux]
Discordrb version:
discordrb (3.4.2 faace0f)