Module: Avm::ApplicationStereotypes::Base::Detection::ClassMethods
- Defined in:
- lib/avm/application_stereotypes/base/detection.rb
Instance Method Summary collapse
- #detect(object) ⇒ Class<Avm::Sources::Base>?
- #detect_by_instance_class?(object) ⇒ Boolean
- #detect_by_name?(object) ⇒ Boolean
- #detect_by_source_class?(object) ⇒ Boolean
Instance Method Details
#detect(object) ⇒ Class<Avm::Sources::Base>?
11 12 13 14 |
# File 'lib/avm/application_stereotypes/base/detection.rb', line 11 def detect(object) return singleton_instance if %w[name instance_class source_class].any? { |t| send("detect_by_#{t}?", object) } end |
#detect_by_instance_class?(object) ⇒ Boolean
17 18 19 |
# File 'lib/avm/application_stereotypes/base/detection.rb', line 17 def detect_by_instance_class?(object) object.is_a?(::Class) && singleton_instance.instance_class == object end |
#detect_by_name?(object) ⇒ Boolean
22 23 24 |
# File 'lib/avm/application_stereotypes/base/detection.rb', line 22 def detect_by_name?(object) object.is_a?(::String) && singleton_instance.name == object end |
#detect_by_source_class?(object) ⇒ Boolean
27 28 29 |
# File 'lib/avm/application_stereotypes/base/detection.rb', line 27 def detect_by_source_class?(object) object.is_a?(::Class) && singleton_instance.source_class == object end |