Class: Hashira::Coupling::Census
- Inherits:
-
Object
- Object
- Hashira::Coupling::Census
- Defined in:
- lib/hashira/coupling/census.rb
Instance Method Summary collapse
- #charge(file, nesting) ⇒ Object
- #folds ⇒ Object
- #holder(segments) ⇒ Object
-
#initialize(project, trees, packaging: :folder) ⇒ Census
constructor
A new instance of Census.
- #origins ⇒ Object
- #packages ⇒ Object
- #packaging ⇒ Object
- #pinpoint(segments) ⇒ Object
- #prefix ⇒ Object
- #resolve(segments, nesting = []) ⇒ Object
- #roots ⇒ Object
- #strip(segments) ⇒ Object
- #types ⇒ Object
Constructor Details
#initialize(project, trees, packaging: :folder) ⇒ Census
Returns a new instance of Census.
4 5 6 7 8 9 10 |
# File 'lib/hashira/coupling/census.rb', line 4 def initialize(project, trees, packaging: :folder) @catalog = Hashira::Coupling::Catalog.new(Hashira::Coupling::Definitions.new(project, trees)) @placement = Hashira::Coupling::Placement.build(packaging, project, @catalog) @folding = Hashira::Coupling::NoFolding @roster = tally settle end |
Instance Method Details
#charge(file, nesting) ⇒ Object
37 |
# File 'lib/hashira/coupling/census.rb', line 37 def charge(file, nesting) = translate(@placement.charge(file, nesting)) |
#folds ⇒ Object
24 |
# File 'lib/hashira/coupling/census.rb', line 24 def folds = @folding.disclosed |
#holder(segments) ⇒ Object
28 29 30 31 |
# File 'lib/hashira/coupling/census.rb', line 28 def holder(segments) path = strip(segments) (path.length.downto(1).map { path.first(it) }.find { type?(it) } || path).join("::") end |
#origins ⇒ Object
18 |
# File 'lib/hashira/coupling/census.rb', line 18 def origins = @roster.origins |
#packages ⇒ Object
22 |
# File 'lib/hashira/coupling/census.rb', line 22 def packages = @roster.packages | @placement.baseline |
#packaging ⇒ Object
12 |
# File 'lib/hashira/coupling/census.rb', line 12 def packaging = @placement.mode |
#pinpoint(segments) ⇒ Object
35 |
# File 'lib/hashira/coupling/census.rb', line 35 def pinpoint(segments) = scope.pinpoint(segments) |
#prefix ⇒ Object
16 |
# File 'lib/hashira/coupling/census.rb', line 16 def prefix = @catalog.prefix |
#resolve(segments, nesting = []) ⇒ Object
33 |
# File 'lib/hashira/coupling/census.rb', line 33 def resolve(segments, nesting = []) = scope.resolve(segments, nesting) |
#roots ⇒ Object
20 |
# File 'lib/hashira/coupling/census.rb', line 20 def roots = @catalog.roots |
#strip(segments) ⇒ Object
26 |
# File 'lib/hashira/coupling/census.rb', line 26 def strip(segments) = @catalog.strip(segments) |
#types ⇒ Object
14 |
# File 'lib/hashira/coupling/census.rb', line 14 def types = @roster.types |