Class: CukeModeler::Outline
- Defined in:
- lib/cuke_modeler/models/outline.rb
Overview
A class modeling an individual outline in a Cucumber suite.
Instance Attribute Summary collapse
-
#examples ⇒ Object
The Example objects contained by the Outline.
-
#keyword ⇒ Object
The outline’s keyword.
Attributes included from Taggable
Attributes included from Sourceable
Attributes included from Stepped
Attributes included from Described
Attributes included from Named
Attributes included from Parsed
Attributes included from Nested
Instance Method Summary collapse
-
#==(other) ⇒ Object
Returns true if the two models have equivalent steps and false otherwise.
-
#children ⇒ Object
Returns the model objects that belong to this model.
-
#initialize(source_text = nil) ⇒ Outline
constructor
Creates a new Outline object and, if source_text is provided, populates the object.
-
#to_s ⇒ Object
Returns a string representation of this model.
Methods included from Taggable
Methods included from Parsing
Methods included from Containing
Methods included from Nested
Constructor Details
#initialize(source_text = nil) ⇒ Outline
Creates a new Outline object and, if source_text is provided, populates the object.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cuke_modeler/models/outline.rb', line 25 def initialize(source_text = nil) @steps = [] = [] @examples = [] super(source_text) return unless source_text parsed_outline_data = parse_source(source_text) populate_outline(self, parsed_outline_data) end |
Instance Attribute Details
#examples ⇒ Object
The Example objects contained by the Outline
20 21 22 |
# File 'lib/cuke_modeler/models/outline.rb', line 20 def examples @examples end |
#keyword ⇒ Object
The outline’s keyword
17 18 19 |
# File 'lib/cuke_modeler/models/outline.rb', line 17 def keyword @keyword end |
Instance Method Details
#==(other) ⇒ Object
Returns true if the two models have equivalent steps and false otherwise.
39 40 41 42 43 |
# File 'lib/cuke_modeler/models/outline.rb', line 39 def ==(other) return false unless other.respond_to?(:steps) steps == other.steps end |
#children ⇒ Object
Returns the model objects that belong to this model.
46 47 48 |
# File 'lib/cuke_modeler/models/outline.rb', line 46 def children examples + steps + end |
#to_s ⇒ Object
Returns a string representation of this model. For an outline model, this will be Gherkin text that is equivalent to the outline being modeled.
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cuke_modeler/models/outline.rb', line 55 def to_s text = '' text << "#{tag_output_string}\n" unless .empty? text << "#{@keyword}:#{name_output_string}" text << "\n#{description_output_string}" unless no_description_to_output? text << "\n" unless steps.empty? || no_description_to_output? text << "\n#{steps_output_string}" unless steps.empty? text << "\n\n#{examples_output_string}" unless examples.empty? text end |