class CucumberAnalytics::FeatureElement
A class modeling an basic element of a feature.
Attributes
description[RW]
Deprecated
The description of the FeatureElement
description_text[RW]
The description of the FeatureElement
name[RW]
The name of the FeatureElement
Public Class Methods
new(parsed_element = nil)
click to toggle source
Creates a new FeatureElement
object and, if parsed_element is provided, populates the object.
# File lib/cucumber_analytics/feature_element.rb, line 26 def initialize(parsed_element = nil) @name = '' @description = [] @description_text = '' build_feature_element(parsed_element) if parsed_element end
Private Instance Methods
build_feature_element(parsed_element)
click to toggle source
# File lib/cucumber_analytics/feature_element.rb, line 38 def build_feature_element(parsed_element) populate_feature_element_name(parsed_element) populate_feature_element_description(parsed_element) populate_element_source_line(parsed_element) populate_raw_element(parsed_element) end
description_output_string()
click to toggle source
# File lib/cucumber_analytics/feature_element.rb, line 59 def description_output_string text = '' unless description_text.empty? description_lines = description_text.split("\n") text << " \n" if description_lines.first =~ /\S/ text << description_lines.collect { |line| " #{line}" }.join("\n") end text end
name_output_string()
click to toggle source
# File lib/cucumber_analytics/feature_element.rb, line 55 def name_output_string name.empty? ? '' : " #{name}" end
populate_feature_element_description(parsed_element)
click to toggle source
# File lib/cucumber_analytics/feature_element.rb, line 49 def populate_feature_element_description(parsed_element) @description_text = parsed_element['description'] @description = parsed_element['description'].split("\n").collect { |line| line.strip } @description.delete('') end
populate_feature_element_name(parsed_element)
click to toggle source
# File lib/cucumber_analytics/feature_element.rb, line 45 def populate_feature_element_name(parsed_element) @name = parsed_element['name'] end