Class: Discordrb::Webhooks::View
- Inherits:
-
Object
- Object
- Discordrb::Webhooks::View
- Defined in:
- lib/discordrb/webhooks/view.rb
Overview
A reusable view representing a component collection, with builder methods.
Direct Known Subclasses
Defined Under Namespace
Classes: RowBuilder, SelectMenuBuilder
Constant Summary collapse
- BUTTON_STYLES =
Possible button style names and values.
{ primary: 1, secondary: 2, success: 3, danger: 4, link: 5 }.freeze
- COMPONENT_TYPES =
Component types.
{ action_row: 1, button: 2, select_menu: 3 }.freeze
Instance Attribute Summary collapse
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ View
constructor
A new instance of View.
-
#row {|| ... } ⇒ Object
Add a new ActionRow to the view.
Constructor Details
#initialize {|_self| ... } ⇒ View
Returns a new instance of View.
119 120 121 122 123 |
# File 'lib/discordrb/webhooks/view.rb', line 119 def initialize @rows = [] yield self if block_given? end |
Instance Attribute Details
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
117 118 119 |
# File 'lib/discordrb/webhooks/view.rb', line 117 def rows @rows end |
Instance Method Details
#row {|| ... } ⇒ Object
Add a new ActionRow to the view
127 128 129 130 131 132 133 |
# File 'lib/discordrb/webhooks/view.rb', line 127 def row new_row = RowBuilder.new yield new_row @rows << new_row end |