Class: Cukehead::FeatureNodeChild

Inherits:
Object
  • Object
show all
Defined in:
lib/cukehead/feature_node_child.rb

Overview

Responsible for extracting the contents of a mind map node representing a sub-section of a feature (such as a Background or Scenario) and providing it as text for a feature file.

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ FeatureNodeChild

Extracts the feature section described in the given node.

Parameters

node - REXML::Element



16
17
18
19
20
21
# File 'lib/cukehead/feature_node_child.rb', line 16

def initialize(node)
  @description = []
  @tags = FeatureNodeTags.new
  @title = node.attributes["TEXT"]
  from_mm_node node
end

Instance Method Details

#to_text(pad) ⇒ Object

Returns the title, tags, and descriptive text extracted from the mind map as a string of text formatted for output to a feature file.

Parameters

pad - String of whitespace to use to indent the section.



29
30
31
32
33
# File 'lib/cukehead/feature_node_child.rb', line 29

def to_text(pad)
  s = "\n"
  @description.each {|d| s += pad + "  " + d + "\n"}
  pad + @tags.to_text(pad) + @title + s
end