Sha256: 9522a1cb03ec6ff0a41de54e3e8fd2139a104a256143c3b2623a83114dab9271

Contents?: true

Size: 576 Bytes

Versions: 1127

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module Playbook
  class KitResolver
    def self.resolve(*args)
      @resolver ||= new
      @resolver.resolve(*args)
    end

    def initialize
      @cache = Hash.new do |_cache, kit_name|
        is_subkit = kit_name.match(%r{[/\\]})
        folder = is_subkit ? kit_name.split("/")[0] : kit_name
        item = is_subkit ? kit_name.split("/")[-1] : kit_name
        @cache[kit_name] = "Playbook::Pb#{folder.camelize}::#{item.camelize}"
      end
    end

    def resolve(kit_name)
      @cache[kit_name].safe_constantize
    end
  end
end

Version data entries

1,127 entries across 1,127 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 lib/playbook/kit_resolver.rb
playbook_ui-14.12.0.pre.rc.11 lib/playbook/kit_resolver.rb
playbook_ui-14.12.0.pre.rc.10 lib/playbook/kit_resolver.rb
playbook_ui-14.12.0.pre.rc.9 lib/playbook/kit_resolver.rb
playbook_ui-14.12.0.pre.rc.8 lib/playbook/kit_resolver.rb
playbook_ui-14.12.0.pre.rc.7 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 lib/playbook/kit_resolver.rb
playbook_ui-14.12.0.pre.rc.6 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 lib/playbook/kit_resolver.rb
playbook_ui-14.12.0.pre.rc.5 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 lib/playbook/kit_resolver.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 lib/playbook/kit_resolver.rb