Sha256: ff951ba47a44bdc32857ec18b65837f523a3a03a7acabb18ab39a190706e5292

Contents?: true

Size: 1.26 KB

Versions: 20

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require 'avm/registry/with_path'

module Avm
  module Registry
    class Sources < ::Avm::Registry::WithPath
      # @return [Avm::ApplicationStereotypes::Base]
      def application_stereotype_by_name(name)
        ::Avm::Registry.application_stereotypes.detect(name)
      end

      # @return [Avm::Sources::Base, nil]
      def detect_optional(*detect_args)
        detect_optional_by_configuration(*detect_args) ||
          detect_optional_by_application_configuration(*detect_args) ||
          super
      end

      # @return [Avm::Sources::Base, nil]
      def detect_optional_by_application_configuration(path, *detect_args)
        ::Avm::Sources::Base.new(path).application.stereotype_by_configuration.if_present do |v|
          v.source_class.new(path, *detect_args)
        end
      end

      # @return [Avm::Sources::Base, nil]
      def detect_optional_by_configuration(path, *detect_args)
        source_configured_stereotype_name(path).if_present do |v|
          application_stereotype_by_name(v).source_class.new(path, *detect_args)
        end
      end

      # @return [String]
      def source_configured_stereotype_name(path)
        ::Avm::Sources::Base.new(path).stereotype_name_by_configuration
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
avm-0.94.1 lib/avm/registry/sources.rb
eac_tools-0.98.0 sub/avm/lib/avm/registry/sources.rb
avm-0.94.0 lib/avm/registry/sources.rb
eac_tools-0.94.0 sub/avm/lib/avm/registry/sources.rb
avm-0.93.0 lib/avm/registry/sources.rb
eac_tools-0.92.0 sub/avm/lib/avm/registry/sources.rb
avm-0.92.0 lib/avm/registry/sources.rb
eac_tools-0.91.0 sub/avm/lib/avm/registry/sources.rb
avm-0.90.1 lib/avm/registry/sources.rb
eac_tools-0.87.1 sub/avm/lib/avm/registry/sources.rb
avm-0.90.0 lib/avm/registry/sources.rb
eac_tools-0.87.0 sub/avm/lib/avm/registry/sources.rb
avm-0.89.0 lib/avm/registry/sources.rb
eac_tools-0.86.12 sub/avm/lib/avm/registry/sources.rb
avm-0.88.0 lib/avm/registry/sources.rb
eac_tools-0.86.11 sub/avm/lib/avm/registry/sources.rb
avm-0.87.0 lib/avm/registry/sources.rb
eac_tools-0.86.8 sub/avm/lib/avm/registry/sources.rb
avm-0.86.2 lib/avm/registry/sources.rb
eac_tools-0.86.7 sub/avm/lib/avm/registry/sources.rb