Sha256: 742c32bec7e79a63aba4e0360341576e22854b74297c0e0dd4e57b74c55674c3

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Primer
  # :nodoc:
  module Deprecations
    # If there is no alternative to suggest, set the value to nil
    DEPRECATED_COMPONENTS = {
      "Primer::Alpha::AutoComplete" => "Primer::Beta::AutoComplete",
      "Primer::Alpha::AutoComplete::Item" => "Primer::Beta::AutoComplete::Item",
      "Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
      "Primer::BoxComponent" => "Primer::Box",
      "Primer::ButtonComponent" => "Primer::Beta::Button",
      "Primer::CloseButton" => "Primer::Beta::CloseButton",
      "Primer::CounterComponent" => "Primer::Beta::Counter",
      "Primer::DetailsComponent" => "Primer::Beta::Details",
      "Primer::DropdownMenuComponent" => nil,
      "Primer::FlexComponent" => nil,
      "Primer::FlexItemComponent" => nil,
      "Primer::HeadingComponent" => "Primer::Beta::Heading",
      "Primer::HiddenTextExpander" => "Primer::Alpha::HiddenTextExpander",
      "Primer::IconButton" => "Primer::Beta::IconButton",
      "Primer::Tooltip" => "Primer::Alpha::Tooltip"
    }.freeze

    def self.deprecated?(name)
      DEPRECATED_COMPONENTS.key?(name)
    end

    def self.suggested_component(name)
      DEPRECATED_COMPONENTS[name]
    end

    def self.correctable?(name)
      !suggested_component(name).nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
primer_view_components-0.0.97 lib/primer/deprecations.rb
primer_view_components-0.0.96 lib/primer/deprecations.rb
primer_view_components-0.0.95 lib/primer/deprecations.rb