Class: Slack::BlockKit::Layout::RichText::RichTextList
- Inherits:
-
Object
- Object
- Slack::BlockKit::Layout::RichText::RichTextList
- Defined in:
- lib/slack/block_kit/layout/rich_text/rich_text_list.rb
Overview
Constant Summary collapse
- TYPE =
'rich_text_list'
Instance Attribute Summary collapse
-
#border ⇒ Object
Returns the value of attribute border.
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
- #append(element) ⇒ Object
- #as_json ⇒ Object
-
#initialize(style:, indent: nil, offset: nil, border: nil) {|_self| ... } ⇒ RichTextList
constructor
A new instance of RichTextList.
- #rich_text_section {|element| ... } ⇒ Object
Constructor Details
#initialize(style:, indent: nil, offset: nil, border: nil) {|_self| ... } ⇒ RichTextList
Returns a new instance of RichTextList.
13 14 15 16 17 18 19 20 21 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 13 def initialize(style:, indent: nil, offset: nil, border: nil) @elements = [] @style = style @indent = indent @offset = offset @border = border yield(self) if block_given? end |
Instance Attribute Details
#border ⇒ Object
Returns the value of attribute border.
11 12 13 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 11 def border @border end |
#elements ⇒ Object
Returns the value of attribute elements.
11 12 13 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 11 def elements @elements end |
#indent ⇒ Object
Returns the value of attribute indent.
11 12 13 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 11 def indent @indent end |
#offset ⇒ Object
Returns the value of attribute offset.
11 12 13 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 11 def offset @offset end |
#style ⇒ Object
Returns the value of attribute style.
11 12 13 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 11 def style @style end |
Instance Method Details
#append(element) ⇒ Object
31 32 33 34 35 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 31 def append(element) @elements << element self end |
#as_json ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 37 def as_json(*) { type: TYPE, style: @style, elements: @elements.map(&:as_json), indent: @indent, offset: @offset, border: @border }.compact end |
#rich_text_section {|element| ... } ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_list.rb', line 23 def rich_text_section element = RichTextSection.new yield(element) if block_given? append(element) end |