Method: AcademicBenchmarks::Standards::StandardsForest#initialize

Defined in:
lib/academic_benchmarks/standards/standards_forest.rb

#initialize(data_hash) ⇒ StandardsForest

Returns a new instance of StandardsForest.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/academic_benchmarks/standards/standards_forest.rb', line 6

def initialize(data_hash)
  @guid_to_standard = {} # a hash of guids to standards
  @trees = []
  @orphans = []
  process_items(data_hash)

  # upgrade the hash data to a StandardsTree object
  @trees.map! do |item|
    StandardsTree.new(item)
  end

  # We will still have the guid-to-standards saved at the Tree level,
  # so we can safely remove this variable and let the GC free the memory
  remove_instance_variable('@guid_to_standard')
end