Module: Slack::BlockKit::Layout::RichText::RichTextElements::StyleHelper
- Defined in:
- lib/slack/block_kit/layout/rich_text/rich_text_elements/style_helper.rb
Instance Method Summary collapse
Instance Method Details
#styles_as_json(styles) ⇒ Object
15 16 17 18 19 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_elements/style_helper.rb', line 15 def styles_as_json(styles) return if styles.empty? styles.each_with_object({}) { |style, block| block[style] = true } end |
#validate_styles(provided_styles, valid_styles) ⇒ Object
9 10 11 12 13 |
# File 'lib/slack/block_kit/layout/rich_text/rich_text_elements/style_helper.rb', line 9 def validate_styles(provided_styles, valid_styles) provided_styles.each do |style| raise ArgumentError, "Invalid style: #{style}. Valid styles: #{valid_styles}." unless valid_styles.include?(style) end end |