Class: Hashira::Analysis::Folding

Inherits:
Object
  • Object
show all
Defined in:
lib/hashira/analysis/folding.rb

Constant Summary collapse

SUFFIXES =
%w[Resource Serializer Policy Decorator].freeze

Instance Method Summary collapse

Constructor Details

#initialize(definitions, census, suffixes: []) ⇒ Folding

Returns a new instance of Folding.



8
9
10
11
12
# File 'lib/hashira/analysis/folding.rb', line 8

def initialize(definitions, census, suffixes: [])
  @definitions = definitions
  @census = census
  @suffixes = suffixes
end

Instance Method Details

#disclosedObject



16
17
18
# File 'lib/hashira/analysis/folding.rb', line 16

def disclosed
  map.map { |from, to| { from:, to:, via: parents.key?(from) ? "base" : "suffix" } }
end

#mapObject



14
# File 'lib/hashira/analysis/folding.rb', line 14

def map = @map ||= links.keys.to_h { [it, settle(it, links)] }.reject { |from, to| from == to }