Class: PartialKs::ParentInferrer
- Inherits:
-
Object
- Object
- PartialKs::ParentInferrer
- Defined in:
- lib/partial_ks/parent_inferrer.rb
Constant Summary collapse
- CannotInfer =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #inferred_parent_class ⇒ Object
-
#initialize(table) ⇒ ParentInferrer
constructor
A new instance of ParentInferrer.
Constructor Details
#initialize(table) ⇒ ParentInferrer
Returns a new instance of ParentInferrer.
7 8 9 |
# File 'lib/partial_ks/parent_inferrer.rb', line 7 def initialize(table) @table = table end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
5 6 7 |
# File 'lib/partial_ks/parent_inferrer.rb', line 5 def table @table end |
Instance Method Details
#inferred_parent_class ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/partial_ks/parent_inferrer.rb', line 11 def inferred_parent_class if table.top_level_table? nil elsif table.candidate_parent_classes.size == 1 table.candidate_parent_classes.first else raise CannotInfer, "table has multiple candidates for parents" end end |