Class: Hashira::Analysis::Census
- Inherits:
-
Object
- Object
- Hashira::Analysis::Census
- Defined in:
- lib/hashira/analysis/census.rb
Instance Attribute Summary collapse
-
#namespace_prefix ⇒ Object
readonly
Returns the value of attribute namespace_prefix.
-
#type_count ⇒ Object
readonly
Returns the value of attribute type_count.
Instance Method Summary collapse
- #declaring_package ⇒ Object
-
#initialize(project, trees) ⇒ Census
constructor
A new instance of Census.
- #packages ⇒ Object
- #resolve(segments) ⇒ Object
Constructor Details
#initialize(project, trees) ⇒ Census
Returns a new instance of Census.
6 7 8 9 10 11 12 |
# File 'lib/hashira/analysis/census.rb', line 6 def initialize(project, trees) @definitions = Definitions.new(project, trees) @type_count = Hash.new(0) @registry = ConstantRegistry.new @namespace_prefix = NamespacePrefix.infer(@definitions) take end |
Instance Attribute Details
#namespace_prefix ⇒ Object (readonly)
Returns the value of attribute namespace_prefix.
14 15 16 |
# File 'lib/hashira/analysis/census.rb', line 14 def namespace_prefix @namespace_prefix end |
#type_count ⇒ Object (readonly)
Returns the value of attribute type_count.
14 15 16 |
# File 'lib/hashira/analysis/census.rb', line 14 def type_count @type_count end |
Instance Method Details
#declaring_package ⇒ Object
16 |
# File 'lib/hashira/analysis/census.rb', line 16 def declaring_package = @registry.declaring_package |
#packages ⇒ Object
18 |
# File 'lib/hashira/analysis/census.rb', line 18 def packages = (@type_count.keys | @definitions.packages) |
#resolve(segments) ⇒ Object
20 |
# File 'lib/hashira/analysis/census.rb', line 20 def resolve(segments) = @registry.package_for(after_prefix(segments)) |