module ArchSpec::Facts::Application
Applies validated semantic facts, independently of how they were found. Source normalization happens before this boundary; facts establish the resulting relationships, APIs, and execution contexts.
Constants
- MIXIN_TYPES
Public Instance Methods
Source
# File lib/archspec/facts/application.rb, line 25 def apply(graph, batches) validate(graph, batches) dependencies = dependency_index(graph, batches) batches.each do |batch| producer = batch.producer batch.references.each do |fact| add_dependency(graph, dependencies, :references_constant, fact.source, fact.target, fact.location, producer) end batch.methods.each { |fact| install_method(fact) } batch.mixins.each do |fact| fact.owner.add_mixin(fact.kind, "::#{fact.target}") add_dependency(graph, dependencies, MIXIN_TYPES.fetch(fact.kind), fact.owner, fact.target, fact.location, producer, match_location: false) end batch.exposures.each do |fact| graph.expose_instance_methods(fact.source.name, as_owner: exposure_owner_name(fact.owner), scope: fact.scope) end batch.gaps.each do |fact| graph.add_edge(type: :dynamic_feature, from_path: fact.source.path, from_constant: fact.source.name, to: fact.message, location: fact.location, confidence: :unknown_due_to_dynamic_feature, producer: producer) end end resolve_gaps(graph, batches.flat_map(&:resolves)) graph.clear_method_caches bind_receivers(graph, batches.flat_map(&:receivers)) graph end
Source
# File lib/archspec/facts/application.rb, line 54 def validate(graph, batches) validate_exposures(graph, batches.flat_map(&:exposures)) end