Module: MosEisley::S3PO::BlockKit
- Defined in:
- lib/s3po/blockkit.rb
Class Method Summary collapse
-
.emoji_text(txt) ⇒ Hash
Block Kit plain_text object with emoji:true.
-
.option(value, txt, type = :mrkdwn) ⇒ Hash
Block Kit option object.
-
.plain_text(txt) ⇒ Hash
Block Kit plain_text object with emoji:false.
-
.sec_text(txt, type = :mrkdwn) ⇒ Hash
Block Kit section object.
-
.text(txt, type = :mrkdwn) ⇒ Hash
Block Kit text object.
Class Method Details
.emoji_text(txt) ⇒ Hash
Returns Block Kit plain_text object with emoji:true.
39 40 41 |
# File 'lib/s3po/blockkit.rb', line 39 def self.emoji_text(txt) text(txt, :emoji) end |
.option(value, txt, type = :mrkdwn) ⇒ Hash
Returns Block Kit option object.
47 48 49 50 51 52 53 |
# 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) ⇒ Hash
Returns Block Kit plain_text object with emoji:false.
33 34 35 |
# File 'lib/s3po/blockkit.rb', line 33 def self.plain_text(txt) text(txt, :plain) end |
.sec_text(txt, type = :mrkdwn) ⇒ Hash
Returns Block Kit section object.
7 8 9 10 11 12 |
# 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) ⇒ Hash
Returns Block Kit text object.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# 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 |