Class: BlockKit::Types::Mrkdwn

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

Instance Method Summary collapse

Instance Method Details

#block_classObject



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

def block_class = Composition::Mrkdwn

#cast(value) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/block_kit/types/text.rb', line 66

def cast(value)
  case value
  when block_class, NilClass
    value
  when Composition::PlainText
    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



62
63
64
# File 'lib/block_kit/types/text.rb', line 62

def type
  :block_kit_mrkdwn
end