module MosEisley::S3PO::BlockKit
Public Class Methods
emoji_text(txt)
click to toggle source
@param txt [String] @return [Hash] Block Kit plain_text
object with emoji:true
# File lib/s3po/blockkit.rb, line 39 def self.emoji_text(txt) text(txt, :emoji) end
option(value, txt, type = :mrkdwn)
click to toggle source
@param value [String] string that will be passed to the app when selected @param txt [String] @param type [Symbol] :plain_text | :emoji | :mrkdwn @return [Hash] Block Kit option object
# File lib/s3po/blockkit.rb, line 47 def self.option(value, txt, type = :mrkdwn) t = MosEisley::S3PO::BlockKit.text(txt, type) { text: t, value: value, } end
plain_text(txt)
click to toggle source
@param txt [String] @return [Hash] Block Kit plain_text
object with emoji:false
# File lib/s3po/blockkit.rb, line 33 def self.plain_text(txt) text(txt, :plain) end
sec_text(txt, type = :mrkdwn)
click to toggle source
@param txt [String] @param type [Symbol] :plain | :emoji | :mrkdwn @return [Hash] Block Kit section object
# File lib/s3po/blockkit.rb, line 7 def self.sec_text(txt, type = :mrkdwn) { type: :section, text: text(txt, type), } end
text(txt, type = :mrkdwn)
click to toggle source
@param txt [String] @param type [Symbol] :plain | :emoji | :mrkdwn @return [Hash] Block Kit text object
# File lib/s3po/blockkit.rb, line 17 def self.text(txt, type = :mrkdwn) obj = {text: txt} case type when :mrkdwn obj[:type] = type when :emoji obj[:emoji] = true else obj[:emoji] = false end obj[:type] ||= :plain_text obj end