Class: PgVerify::Model::SpecSet

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, assumption, parent, children) ⇒ SpecSet

Returns a new instance of SpecSet.



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

def initialize(text, assumption, parent, children)
    @text, @assumption, @parent, @children = text, assumption, parent, children
end

Instance Attribute Details

#assumptionObject

Returns the value of attribute assumption.



9
10
11
# File 'lib/pg-verify/model/specs/spec_set.rb', line 9

def assumption
  @assumption
end

#childrenObject

The sub-spec sets contained in this spec set



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

def children
  @children
end

#parentObject

Returns the value of attribute parent.



14
15
16
# File 'lib/pg-verify/model/specs/spec_set.rb', line 14

def parent
  @parent
end

#textObject

The text of this spec set as a string.



7
8
9
# File 'lib/pg-verify/model/specs/spec_set.rb', line 7

def text
  @text
end

Class Method Details

.wrap(specs) ⇒ Object



16
17
18
19
20
21
# File 'lib/pg-verify/model/specs/spec_set.rb', line 16

def self.wrap(specs)
    spec_set = self.new("", nil, nil, nil)
    specs.each { |spec| spec.parent = spec_set }
    spec_set.children = specs
    return spec_set
end

Instance Method Details

#get_specsObject



31
32
33
34
35
36
37
38
# File 'lib/pg-verify/model/specs/spec_set.rb', line 31

def get_specs()
    ret = []
    children.each { |child|
        ret << child             if child.is_a?(Spec)
        ret += child.get_specs() if child.is_a?(SpecSet)
    }
    return ret
end

#parent?Boolean

Returns:

  • (Boolean)


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

def parent?
    return !@parent.nil?
end