Class: PgVerify::Model::Spec
- Inherits:
-
Object
- Object
- PgVerify::Model::Spec
- Defined in:
- lib/pg-verify/model/specs/spec.rb
Overview
A single specification and a leave in the tree
Instance Attribute Summary collapse
-
#expression ⇒ Object
The LTL/CTL expression of this spec.
-
#parent ⇒ Object
The parent specification set for this node.
-
#source_location ⇒ Object
Returns the value of attribute source_location.
-
#text ⇒ Object
The text of this spec as a string.
Instance Method Summary collapse
-
#initialize(text, expression, parent) ⇒ Spec
constructor
A new instance of Spec.
- #linage ⇒ Object
- #parent? ⇒ Boolean
- #parents ⇒ Object
Constructor Details
#initialize(text, expression, parent) ⇒ Spec
Returns a new instance of Spec.
18 19 20 21 |
# File 'lib/pg-verify/model/specs/spec.rb', line 18 def initialize(text, expression, parent) raise "Not a #{Model::ParsedExpression}: #{expression}" unless expression.is_a?(Model::ParsedExpression) @text, @expression, @parent = text, expression, parent end |
Instance Attribute Details
#expression ⇒ Object
The LTL/CTL expression of this spec
11 12 13 |
# File 'lib/pg-verify/model/specs/spec.rb', line 11 def expression @expression end |
#parent ⇒ Object
The parent specification set for this node
14 15 16 |
# File 'lib/pg-verify/model/specs/spec.rb', line 14 def parent @parent end |
#source_location ⇒ Object
Returns the value of attribute source_location.
16 17 18 |
# File 'lib/pg-verify/model/specs/spec.rb', line 16 def source_location @source_location end |
#text ⇒ Object
The text of this spec as a string.
8 9 10 |
# File 'lib/pg-verify/model/specs/spec.rb', line 8 def text @text end |
Instance Method Details
#linage ⇒ Object
27 28 29 |
# File 'lib/pg-verify/model/specs/spec.rb', line 27 def linage() return parents() + [ self ] end |
#parent? ⇒ Boolean
23 24 25 |
# File 'lib/pg-verify/model/specs/spec.rb', line 23 def parent? return !@parent.nil? end |
#parents ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/pg-verify/model/specs/spec.rb', line 31 def parents() array = [] current = self while(current.parent?) current = current.parent array << current end return array.reverse() end |