Class: Avm::Registry::Sources

Inherits:
WithPath show all
Defined in:
lib/avm/registry/sources.rb

Instance Method Summary collapse

Methods inherited from WithPath

#class_detect, #detect_by_path, #detect_by_path_optional

Methods inherited from FromGems

#available, #class_detect, #detect, #provider_module_suffix, #single_module_suffix, #to_s, #valid_registered_module?

Instance Method Details

#application_stereotype_by_name(name) ⇒ Avm::ApplicationStereotypes::Base



9
10
11
# File 'lib/avm/registry/sources.rb', line 9

def application_stereotype_by_name(name)
  ::Avm::Registry.application_stereotypes.detect(name)
end

#detect_optional(*detect_args) ⇒ Avm::Sources::Base?

Returns:



14
15
16
17
18
# File 'lib/avm/registry/sources.rb', line 14

def detect_optional(*detect_args)
  detect_optional_by_configuration(*detect_args) ||
    detect_optional_by_application_configuration(*detect_args) ||
    super
end

#detect_optional_by_application_configuration(path, *detect_args) ⇒ Avm::Sources::Base?

Returns:



21
22
23
24
25
# File 'lib/avm/registry/sources.rb', line 21

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

#detect_optional_by_configuration(path, *detect_args) ⇒ Avm::Sources::Base?

Returns:



28
29
30
31
32
# File 'lib/avm/registry/sources.rb', line 28

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

#source_configured_stereotype_name(path) ⇒ String

Returns:

  • (String)


35
36
37
# File 'lib/avm/registry/sources.rb', line 35

def source_configured_stereotype_name(path)
  ::Avm::Sources::Base.new(path).stereotype_name_by_configuration
end