Class: Slackert::Blocks::BlockElement

Inherits:
Object
  • Object
show all
Defined in:
lib/slackert/blocks.rb

Overview

Abstract BlockElement. Subclass and override to_slack to add a new block element.

Direct Known Subclasses

Divider, Header, Section

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ BlockElement

Returns a new instance of BlockElement.



9
10
11
# File 'lib/slackert/blocks.rb', line 9

def initialize(type)
  @type = type
end

Instance Method Details

#to_slackObject

Returns a hash of the element, ready to be added to the block formatted message. Abstract method that needs to be implemented in each subclassed element.

Raises:

  • (NoMethodError)


16
17
18
# File 'lib/slackert/blocks.rb', line 16

def to_slack
  raise NoMethodError, 'Override this implementation'
end