Class: Igniter::Contracts::Assembly::Kernel
- Inherits:
-
Object
- Object
- Igniter::Contracts::Assembly::Kernel
- Defined in:
- lib/igniter/contracts/assembly/kernel.rb
Instance Attribute Summary collapse
-
#diagnostics_contributors ⇒ Object
readonly
Returns the value of attribute diagnostics_contributors.
-
#dsl_keywords ⇒ Object
readonly
Returns the value of attribute dsl_keywords.
-
#effects ⇒ Object
readonly
Returns the value of attribute effects.
-
#executors ⇒ Object
readonly
Returns the value of attribute executors.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#normalizers ⇒ Object
readonly
Returns the value of attribute normalizers.
-
#pack_manifests ⇒ Object
readonly
Returns the value of attribute pack_manifests.
-
#runtime_handlers ⇒ Object
readonly
Returns the value of attribute runtime_handlers.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
- #finalize ⇒ Object
- #finalized? ⇒ Boolean
-
#initialize(nodes: Registry.new(name: :nodes), dsl_keywords: Registry.new(name: :dsl_keywords), validators: OrderedRegistry.new(name: :validators), normalizers: OrderedRegistry.new(name: :normalizers), runtime_handlers: Registry.new(name: :runtime_handlers), diagnostics_contributors: OrderedRegistry.new(name: :diagnostics_contributors), effects: Registry.new(name: :effects), executors: Registry.new(name: :executors)) ⇒ Kernel
constructor
A new instance of Kernel.
- #install(pack, installing: []) ⇒ Object
Constructor Details
#initialize(nodes: Registry.new(name: :nodes), dsl_keywords: Registry.new(name: :dsl_keywords), validators: OrderedRegistry.new(name: :validators), normalizers: OrderedRegistry.new(name: :normalizers), runtime_handlers: Registry.new(name: :runtime_handlers), diagnostics_contributors: OrderedRegistry.new(name: :diagnostics_contributors), effects: Registry.new(name: :effects), executors: Registry.new(name: :executors)) ⇒ Kernel
Returns a new instance of Kernel.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 17 def initialize( nodes: Registry.new(name: :nodes), dsl_keywords: Registry.new(name: :dsl_keywords), validators: OrderedRegistry.new(name: :validators), normalizers: OrderedRegistry.new(name: :normalizers), runtime_handlers: Registry.new(name: :runtime_handlers), diagnostics_contributors: OrderedRegistry.new(name: :diagnostics_contributors), effects: Registry.new(name: :effects), executors: Registry.new(name: :executors) ) @nodes = nodes @dsl_keywords = dsl_keywords @validators = validators @normalizers = normalizers @runtime_handlers = runtime_handlers @diagnostics_contributors = diagnostics_contributors @pack_manifests = [] @effects = effects @executors = executors @finalized = false end |
Instance Attribute Details
#diagnostics_contributors ⇒ Object (readonly)
Returns the value of attribute diagnostics_contributors.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def diagnostics_contributors @diagnostics_contributors end |
#dsl_keywords ⇒ Object (readonly)
Returns the value of attribute dsl_keywords.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def dsl_keywords @dsl_keywords end |
#effects ⇒ Object (readonly)
Returns the value of attribute effects.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def effects @effects end |
#executors ⇒ Object (readonly)
Returns the value of attribute executors.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def executors @executors end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def nodes @nodes end |
#normalizers ⇒ Object (readonly)
Returns the value of attribute normalizers.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def normalizers @normalizers end |
#pack_manifests ⇒ Object (readonly)
Returns the value of attribute pack_manifests.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def pack_manifests @pack_manifests end |
#runtime_handlers ⇒ Object (readonly)
Returns the value of attribute runtime_handlers.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def runtime_handlers @runtime_handlers end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
7 8 9 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 7 def validators @validators end |
Instance Method Details
#finalize ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 58 def finalize validate_completeness! validate_hook_implementations! freeze_registries! @finalized = true Profile.build_from(self) end |
#finalized? ⇒ Boolean
66 67 68 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 66 def finalized? @finalized end |
#install(pack, installing: []) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/igniter/contracts/assembly/kernel.rb', line 39 def install(pack, installing: []) raise FrozenKernelError, "kernel already finalized" if finalized? manifest = pack.respond_to?(:manifest) ? pack.manifest : nil pack_name = manifest&.name return self if pack_name && pack_installed?(pack_name) if pack_name && installing.include?(pack_name) cycle = (installing + [pack_name]).join(" -> ") raise CircularPackDependencyError, "circular pack dependency detected: #{cycle}" end install_required_packs(manifest, installing: [*installing, pack_name].compact) if manifest register_pack_manifest(pack, manifest: manifest) pack.install_into(self) self end |