Class: Holistic::Ruby::Parser::TableOfContents

Inherits:
Object
  • Object
show all
Defined in:
lib/holistic/ruby/parser/table_of_contents.rb

Overview

TODO: move to an attibute of the scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTableOfContents

Returns a new instance of TableOfContents.



8
9
10
# File 'lib/holistic/ruby/parser/table_of_contents.rb', line 8

def initialize
  @records = Hash.new { |hash, key| hash[key] = {} }
end

Instance Attribute Details

#recordsObject (readonly)

Returns the value of attribute records.



6
7
8
# File 'lib/holistic/ruby/parser/table_of_contents.rb', line 6

def records
  @records
end

Instance Method Details

#register(scope:, name:, clue:) ⇒ Object



12
13
14
15
# File 'lib/holistic/ruby/parser/table_of_contents.rb', line 12

def register(scope:, name:, clue:)
  @records[scope.fully_qualified_name][name] ||= []
  @records[scope.fully_qualified_name][name] << clue
end