Class: AcademicBenchmarks::Standards::StandardsTree
- Inherits:
-
Object
- Object
- AcademicBenchmarks::Standards::StandardsTree
- Defined in:
- lib/academic_benchmarks/standards/standards_tree.rb
Instance Attribute Summary collapse
-
#orphans ⇒ Object
readonly
Returns the value of attribute orphans.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #add_orphan(orphan) ⇒ Object
- #add_orphans(orphans) ⇒ Object
- #has_orphans? ⇒ Boolean
-
#initialize(root) ⇒ StandardsTree
constructor
A new instance of StandardsTree.
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
#orphans ⇒ Object (readonly)
Returns the value of attribute orphans.
6 7 8 |
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 6 def orphans @orphans end |
#root ⇒ Object (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
23 24 25 |
# File 'lib/academic_benchmarks/standards/standards_tree.rb', line 23 def has_orphans? @orphans.present? end |