Class: Slackened::BlockKit::Blocks::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/slackened/block_kit/blocks/base.rb

Direct Known Subclasses

Actions, Button, Context, Custom, Divider, Header, Section, Text

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block.



22
23
24
# File 'lib/slackened/block_kit/blocks/base.rb', line 22

def block
  @block
end

Instance Method Details

#set(block) ⇒ Object



24
25
26
# File 'lib/slackened/block_kit/blocks/base.rb', line 24

def set(block)
	@block = block
end

#to_hObject

recursion?



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/slackened/block_kit/blocks/base.rb', line 29

def to_h
	@block.to_h do |key, value|
		case value
		when Array
			[key, value.map(&:to_h)]
		when Base
			[key, value.to_h]
		else
			[key, value]
		end
	end
end