Class: BlockKit::Layout::RichText

Inherits:
Base
  • Object
show all
Defined in:
lib/block_kit/layout/rich_text.rb

Defined Under Namespace

Modules: Elements Classes: List, Preformatted, Quote, Section

Constant Summary collapse

SUPPORTED_ELEMENTS =
[
  RichText::List,
  RichText::Preformatted,
  RichText::Quote,
  RichText::Section
].freeze

Constants inherited from Base

Base::MAX_BLOCK_ID_LENGTH

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Methods inherited from Base

#==, fix, #fix_validation_errors, #fix_validation_errors!, fixes, inherited, #initialize, inspect, #inspect, #pretty_print, #to_json

Constructor Details

This class inherits a constructor from BlockKit::Layout::Base

Instance Method Details

#append(element) ⇒ Object



35
36
37
38
39
# File 'lib/block_kit/layout/rich_text.rb', line 35

def append(element)
  elements << element

  self
end

#as_jsonObject



41
42
43
# File 'lib/block_kit/layout/rich_text.rb', line 41

def as_json(*)
  super.merge(elements: elements&.map(&:as_json)).compact
end