Class: Rubycord::Webhooks::Modal

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycord/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:



58
59
60
61
62
# File 'lib/rubycord/webhooks/modal.rb', line 58

def initialize
  @rows = []

  yield self if block_given?
end

Instance Attribute Details

#rowsObject (readonly)

Returns the value of attribute rows.



56
57
58
# File 'lib/rubycord/webhooks/modal.rb', line 56

def rows
  @rows
end

Instance Method Details

#row {|| ... } ⇒ Object

Add a new ActionRow to the view

Yield Parameters:



66
67
68
69
70
71
72
# File 'lib/rubycord/webhooks/modal.rb', line 66

def row
  new_row = RowBuilder.new

  yield new_row

  @rows << new_row
end