Class: DiscordRDA::Components::Section

Inherits:
Base
  • Object
show all
Defined in:
lib/discord_rda/interactions/components.rb

Overview

Section component (V2)

Instance Attribute Summary

Attributes inherited from Base

#data, #type

Instance Method Summary collapse

Methods inherited from Base

#to_h

Constructor Details

#initialize(components:, accessory: nil, id: nil) ⇒ Section

Returns a new instance of Section.



301
302
303
304
305
306
# File 'lib/discord_rda/interactions/components.rb', line 301

def initialize(components:, accessory: nil, id: nil)
  data = { components: components.map(&:to_h) }
  data[:accessory] = accessory.to_h if accessory
  data[:id] = id if id
  super(:section, data)
end