Class: Avm::Registry::FromGems
- Inherits:
-
Object
- Object
- Avm::Registry::FromGems
show all
- Defined in:
- lib/avm/registry/from_gems.rb
Instance Method Summary
collapse
Instance Method Details
#available ⇒ Object
13
14
15
|
# File 'lib/avm/registry/from_gems.rb', line 13
def available
registered_modules.reject(&:abstract?)
end
|
#class_detect(_klass, _detect_args) ⇒ Object
17
18
19
|
# File 'lib/avm/registry/from_gems.rb', line 17
def class_detect(_klass, _detect_args)
raise_abstract_method __method__
end
|
#detect(*registered_initialize_args) ⇒ Object
21
22
23
24
|
# File 'lib/avm/registry/from_gems.rb', line 21
def detect(*registered_initialize_args)
detect_optional(*registered_initialize_args) ||
raise_not_found(*registered_initialize_args)
end
|
#detect_optional(*registered_initialize_args) ⇒ Object
26
27
28
29
|
# File 'lib/avm/registry/from_gems.rb', line 26
def detect_optional(*registered_initialize_args)
available.reverse.lazy
.map { |klass| class_detect(klass, registered_initialize_args) }.find(&:present?)
end
|
#provider_module_suffix ⇒ Object
31
32
33
|
# File 'lib/avm/registry/from_gems.rb', line 31
def provider_module_suffix
"#{module_suffix}::Provider"
end
|
#single_module_suffix ⇒ Object
35
36
37
|
# File 'lib/avm/registry/from_gems.rb', line 35
def single_module_suffix
"#{module_suffix}::Base"
end
|
#to_s ⇒ Object
39
40
41
|
# File 'lib/avm/registry/from_gems.rb', line 39
def to_s
"#{self.class}[#{module_suffix}]"
end
|
#valid_registered_module?(a_module) ⇒ Boolean
43
44
45
|
# File 'lib/avm/registry/from_gems.rb', line 43
def valid_registered_module?(a_module)
a_module.is_a?(::Class) && !a_module.abstract?
end
|