Sha256: a0a7bb79309e473e57e6739b9f3bc2b0b6b89bb048dd51e9bb74f5073430e5b3

Contents?: true

Size: 575 Bytes

Versions: 62

Compression:

Stored size: 575 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

62 entries across 62 versions & 1 rubygems

Version Path
playbook_ui-9.10.0 lib/playbook/kit_resolver.rb
playbook_ui-9.10.0.pre.date.time.stacked.1 lib/playbook/kit_resolver.rb
playbook_ui-9.9.0.alpha.inline1 lib/playbook/kit_resolver.rb
playbook_ui-9.9.0 lib/playbook/kit_resolver.rb
playbook_ui-9.8.0 lib/playbook/kit_resolver.rb
playbook_ui-9.7.0.pre.alphawidth1 lib/playbook/kit_resolver.rb
playbook_ui-9.7.0.pre.alpha.a11y.btn lib/playbook/kit_resolver.rb
playbook_ui-9.7.0 lib/playbook/kit_resolver.rb
playbook_ui-9.6.1 lib/playbook/kit_resolver.rb
playbook_ui-9.6.1.pre.deps1 lib/playbook/kit_resolver.rb
playbook_ui-9.6.0 lib/playbook/kit_resolver.rb
playbook_ui-9.5.0.alpha.rs.downgrade lib/playbook/kit_resolver.rb
playbook_ui-9.5.0 lib/playbook/kit_resolver.rb
playbook_ui-9.4.0.alpha.sisense lib/playbook/kit_resolver.rb
playbook_ui-9.4.0.alpha.user.kit.bug lib/playbook/kit_resolver.rb
playbook_ui-9.4.0 lib/playbook/kit_resolver.rb
playbook_ui-9.3.1.pre.alpha2 lib/playbook/kit_resolver.rb
playbook_ui-9.4.0.pre.alpha2 lib/playbook/kit_resolver.rb
playbook_ui-9.4.0.pre.alpha1 lib/playbook/kit_resolver.rb
playbook_ui-9.3.1.pre.alpha1 lib/playbook/kit_resolver.rb