Class: Slack::Message
- Inherits:
-
Object
- Object
- Slack::Message
- Defined in:
- lib/slack/message.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #add_attachment(attachment) ⇒ Object
- #as_json ⇒ Object
-
#initialize(text, attachment = nil) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(text, attachment = nil) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 |
# File 'lib/slack/message.rb', line 8 def initialize(text, = nil) @text = text @attachments = [] @attachments << if end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
6 7 8 |
# File 'lib/slack/message.rb', line 6 def @attachments end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/slack/message.rb', line 5 def text @text end |
Instance Method Details
#add_attachment(attachment) ⇒ Object
14 15 16 |
# File 'lib/slack/message.rb', line 14 def () @attachments << end |
#as_json ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/slack/message.rb', line 18 def as_json hash = { text: text } (hash) unless .empty? hash end |