Sha256: ed2428c89e1543506d144e0f6f9cf1a941133ab45d1b515efd7b0e63db76fb1f
Contents?: true
Size: 469 Bytes
Versions: 4
Compression:
Stored size: 469 Bytes
Contents
# frozen_string_literal: true class CalloutComponent < ViewComponent::Base VALID_VARIANTS = ['success', 'info', 'warning', 'danger'].freeze def initialize(title:, description:, variant:) @title = title @description = description @variant = validate_variant(variant) end private def validate_variant(variant) raise ArgumentError, "Invalid variant" unless VALID_VARIANTS.include?(variant) variant end end
Version data entries
4 entries across 4 versions & 1 rubygems