Class: BlockKit::Types::PlainText

Inherits:
Text
  • Object
show all
Defined in:
lib/block_kit/types/text.rb

Instance Method Summary collapse

Instance Method Details

#block_classObject



39
# File 'lib/block_kit/types/text.rb', line 39

def block_class = Composition::PlainText

#cast(value) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/block_kit/types/text.rb', line 45

def cast(value)
  case value
  when block_class, NilClass
    value
  when Composition::Mrkdwn
    block_class.new(text: value.text)
  when Hash
    block_class.new(**value.with_indifferent_access.slice(*block_class.attribute_names).symbolize_keys)
  else
    block_class.new(text: value)
  end
end

#typeObject



41
42
43
# File 'lib/block_kit/types/text.rb', line 41

def type
  :block_kit_plain_text
end