Class: OKF::Bundle::References

Inherits:
Object
  • Object
show all
Defined in:
lib/okf/bundle/references.rb

Overview

The §6.3 inventory, pure: every file under references/ — handed in by the shell as files, because the reader models concepts and this model performs no disk access — with which concepts cite each one through the §6.2 path-valued fields (resource, sources.resource, computation, executor.resource, attester.resource), plus the pointers into references/ that resolve to nothing.

The bare-path trap is what the dangling list exists to surface: §6.2 resolves a bare path relative to the concept, so references/x works from the bundle root and silently misses one directory down. When the missed spelling would have hit with a leading slash, the entry says so.

Scope is the folder, by design. §6.3 is "a naming convention, not a requirement", and a computation stored beside its concept is legal — and deliberately not this inventory's to list.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bundle, files:) ⇒ References

Returns a new instance of References.



39
40
41
42
43
44
# File 'lib/okf/bundle/references.rb', line 39

def initialize(bundle, files:)
  @bundle = bundle
  @files = files.sort
  @existing = @files.to_set
  build!
end

Instance Attribute Details

#danglingObject (readonly)

Pointers into references/ that resolve to no file, ordered by concept id then field position, each { id:, field:, raw:, resolved:, hint: } — hint names the leading-slash fix when the bare spelling exists at the root, nil otherwise.



37
38
39
# File 'lib/okf/bundle/references.rb', line 37

def dangling
  @dangling
end

#entriesObject (readonly)

Files under references/, sorted by path, each { path:, dir:, kind:, referenced_by: [ { id:, field: } ] } — kind is "concept" when the file is a parsed concept (§6.3 allows both), "file" otherwise. referenced_by is ordered by citing concept id.



31
32
33
# File 'lib/okf/bundle/references.rb', line 31

def entries
  @entries
end

Class Method Details

.build(bundle, files:) ⇒ Object



23
24
25
# File 'lib/okf/bundle/references.rb', line 23

def self.build(bundle, files:)
  new(bundle, files: files)
end