Class: Capistrano::Dingtalk::Messaging::Markdown
- Defined in:
- lib/capistrano/dingtalk/messaging/markdown.rb
Instance Method Summary collapse
- #build_hash(action) ⇒ Object
-
#initialize(info) ⇒ Markdown
constructor
A new instance of Markdown.
- #markdown(action) ⇒ Object
- #markdown_load(action) ⇒ Object
Methods inherited from Base
#build_at_dict, #build_msg_json, #message_for, #message_for_failed, #message_for_reverted, #message_for_reverting, #message_for_updated, #message_for_updating
Methods included from Helpers
#application, #branch, #deployer, #elapsed_time, #stage, #username
Constructor Details
#initialize(info) ⇒ Markdown
Returns a new instance of Markdown.
5 6 7 |
# File 'lib/capistrano/dingtalk/messaging/markdown.rb', line 5 def initialize(info) @info = info || {} end |
Instance Method Details
#build_hash(action) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/capistrano/dingtalk/messaging/markdown.rb', line 25 def build_hash(action) { msgtype: "markdown", markdown: { title: (action), text: markdown_load(action) } } end |
#markdown(action) ⇒ Object
20 21 22 23 |
# File 'lib/capistrano/dingtalk/messaging/markdown.rb', line 20 def markdown(action) method = "message_for_#{action}" respond_to?(method) && send(method) end |
#markdown_load(action) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/capistrano/dingtalk/messaging/markdown.rb', line 9 def markdown_load(action) " ### #{application} action: #{action} deployer: `#{deployer}` branch: `#{branch}` stage: `#{stage}`" end |