Class: Lita::Adapters::Slack::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/adapters/slack/attachment.rb

Overview

A Slack attachment object.

Instance Method Summary collapse

Constructor Details

#initialize(text, **options) ⇒ Attachment

Returns a new instance of Attachment.

Since:

  • 1.6.0



15
16
17
18
# File 'lib/lita/adapters/slack/attachment.rb', line 15

def initialize(text, **options)
  self.text = text
  self.options = options
end

Instance Method Details

#to_hashHash

Converts the attachment into a hash, suitable for being sent to the Slack API.

Since:

  • 1.6.0



22
23
24
25
26
27
# File 'lib/lita/adapters/slack/attachment.rb', line 22

def to_hash
  options.merge({
    fallback: options[:fallback] || text,
    text: text,
  })
end