Sha256: 37c900150f4cf6d3cbad4eafed4d1f9ace9480b444b5ea65faef97153658e7b5

Contents?: true

Size: 550 Bytes

Versions: 1

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

module Slack
  module BlockKit
    class Element
      class ImageElement < Element
        using Refinements::HashCompact
        attr_accessor :image_url, :alt_text

        def self.populate(hash, object)
          object.image_url = hash.fetch(:image_url)
          object.alt_text = hash.fetch(:alt_text)

          super(hash, object)
        end

        def to_h
          super.merge(
            image_url: image_url,
            alt_text: alt_text
          ).compact
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack-block-kit-0.1.0 lib/slack/block_kit/element/image_element.rb