Class: Hashira::Coupling::Census

Inherits:
Object
  • Object
show all
Defined in:
lib/hashira/coupling/census.rb

Instance Method Summary collapse

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))

#foldsObject



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

#originsObject



18
# File 'lib/hashira/coupling/census.rb', line 18

def origins = @roster.origins

#packagesObject



22
# File 'lib/hashira/coupling/census.rb', line 22

def packages = @roster.packages | @placement.baseline

#packagingObject



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)

#prefixObject



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)

#rootsObject



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)

#typesObject



14
# File 'lib/hashira/coupling/census.rb', line 14

def types = @roster.types