Class: PgVerify::Model::Spec

Inherits:
Object
  • Object
show all
Defined in:
lib/pg-verify/model/specs/spec.rb

Overview

A single specification and a leave in the tree

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#expressionObject

The LTL/CTL expression of this spec



11
12
13
# File 'lib/pg-verify/model/specs/spec.rb', line 11

def expression
  @expression
end

#parentObject

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_locationObject

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

#textObject

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

#linageObject



27
28
29
# File 'lib/pg-verify/model/specs/spec.rb', line 27

def linage()
    return parents() + [ self ]
end

#parent?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/pg-verify/model/specs/spec.rb', line 23

def parent?
    return !@parent.nil?
end

#parentsObject



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