Class: Avm::Registry::WithPath

Inherits:
FromGems
  • Object
show all
Defined in:
lib/avm/registry/with_path.rb,
lib/avm/registry/with_path/cache.rb

Direct Known Subclasses

LauncherStereotypes, Scms, Sources

Defined Under Namespace

Classes: Cache

Instance Method Summary collapse

Methods inherited from FromGems

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

Instance Method Details

#class_detect(klass, detect_args) ⇒ Object?

Returns:

  • (Object, nil)


12
13
14
15
# File 'lib/avm/registry/with_path.rb', line 12

def class_detect(klass, detect_args)
  r = klass.new(*detect_args)
  r.valid? ? r : nil
end

#detect_by_path(path) ⇒ Object



17
18
19
# File 'lib/avm/registry/with_path.rb', line 17

def detect_by_path(path)
  detect_by_path_optional(path) || raise_not_found(path)
end

#detect_by_path_optional(path) ⇒ Object



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

def detect_by_path_optional(path)
  on_cache do
    cache.detect_optional(path)
  end
end