Class: Discordrb::Webhooks::Modal

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

Overview

Modal component builder.

Defined Under Namespace

Classes: RowBuilder

Constant Summary collapse

COMPONENT_TYPES =

A mapping of names to types of components usable in a modal.

{
  action_row: 1,
  text_input: 4
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Modal

Returns a new instance of Modal.

Yields:

  • (_self)

Yield Parameters:



60
61
62
63
64
# File 'lib/discordrb/webhooks/modal.rb', line 60

def initialize
  @rows = []

  yield self if block_given?
end

Instance Attribute Details

#rowsObject (readonly)

Returns the value of attribute rows.



58
59
60
# File 'lib/discordrb/webhooks/modal.rb', line 58

def rows
  @rows
end

Instance Method Details

#row {|| ... } ⇒ Object

Add a new ActionRow to the view

Yield Parameters:



68
69
70
71
72
73
74
# File 'lib/discordrb/webhooks/modal.rb', line 68

def row
  new_row = RowBuilder.new

  yield new_row

  @rows << new_row
end