Class: AcademicBenchmarks::Standards::StandardsTree

Inherits:
Object
  • Object
show all
Defined in:
lib/academic_benchmarks/standards/standards_tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ StandardsTree

Returns a new instance of StandardsTree.



9
10
11
12
13
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 9

def initialize(root)
  @orphans = []
  @root = root
  root.rebranch_children if root.is_a?(Authority) || root.is_a?(Publication)
end

Instance Attribute Details

#orphansObject (readonly)

Returns the value of attribute orphans.



6
7
8
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 6

def orphans
  @orphans
end

#rootObject (readonly)

Returns the value of attribute root.



6
7
8
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 6

def root
  @root
end

Instance Method Details

#add_orphan(orphan) ⇒ Object



15
16
17
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 15

def add_orphan(orphan)
  add_orphans([orphan])
end

#add_orphans(orphans) ⇒ Object



19
20
21
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 19

def add_orphans(orphans)
  @orphans.concat(orphans)
end

#has_orphans?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 23

def has_orphans?
  @orphans.present?
end