Class: PgVerify::Model::SpecSet
- Inherits:
-
Object
- Object
- PgVerify::Model::SpecSet
- Defined in:
- lib/pg-verify/model/specs/spec_set.rb
Instance Attribute Summary collapse
-
#assumption ⇒ Object
Returns the value of attribute assumption.
-
#children ⇒ Object
The sub-spec sets contained in this spec set.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#text ⇒ Object
The text of this spec set as a string.
Class Method Summary collapse
Instance Method Summary collapse
- #get_specs ⇒ Object
-
#initialize(text, assumption, parent, children) ⇒ SpecSet
constructor
A new instance of SpecSet.
- #parent? ⇒ Boolean
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
#assumption ⇒ Object
Returns the value of attribute assumption.
9 10 11 |
# File 'lib/pg-verify/model/specs/spec_set.rb', line 9 def assumption @assumption end |
#children ⇒ Object
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 |
#parent ⇒ Object
Returns the value of attribute parent.
14 15 16 |
# File 'lib/pg-verify/model/specs/spec_set.rb', line 14 def parent @parent end |
#text ⇒ Object
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_specs ⇒ Object
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
27 28 29 |
# File 'lib/pg-verify/model/specs/spec_set.rb', line 27 def parent? return !@parent.nil? end |