Sha256: 182f99d2b8a264e7e7441289d22e296c62589f3a33821c0fded4935af18f0b67

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbImage
    class Image < Playbook::PbKit::Base
      PROPS = %i[configured_alt
                 configured_aria
                 configured_classname
                 configured_data
                 configured_id
                 configured_url].freeze

      def initialize(alt: default_configuration,
                     aria: default_configuration,
                     classname: default_configuration,
                     data: default_configuration,
                     id: default_configuration,
                     url: default_configuration)
        self.configured_alt = alt
        self.configured_aria = aria
        self.configured_classname = classname
        self.configured_data = data
        self.configured_id = id
        self.configured_url = url
      end

      def alt
        default_value(configured_alt, "")
      end

      def url
        default_value(configured_url, "")
      end

      def kit_class
        image_options = %w[
          pb_image_kit
          lazyload
          blur_up
        ]
        image_options.reject(&:nil?).join(" ")
      end

      def to_partial_path
        "pb_image/image"
      end

    private

      DEFAULT = Object.new
      private_constant :DEFAULT
      def default_configuration
        DEFAULT
      end
      attr_reader(*PROPS)
      attr_accessor(*PROPS)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
playbook_ui-2.9.4 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.9.3 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.9.2 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.9.1 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.9.0 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.8.9 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.8.8 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.8.7 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.8.6 app/pb_kits/playbook/pb_image/image.rb
playbook_ui-2.8.5 app/pb_kits/playbook/pb_image/image.rb