Sha256: a0a6fca4e22386f42d5059212b156e0aee908f84998248c961b3dc476abc446d

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module CucumberAnalytics

  # A class modeling an basic element of a feature.

  class FeatureElement

    # The name of the FeatureElement
    attr_accessor :name

    # The description of the FeatureElement
    attr_accessor :description

    # The parent object that contains *self*
    attr_accessor :parent_element


    # Creates a new FeatureElement object and, if *parsed_element* is provided,
    # populates the object.
    def initialize(parsed_element = nil)
      @name = ''
      @description =[]

      build_feature_element(parsed_element) if parsed_element
    end


    private


    def build_feature_element(parsed_element)
      populate_feature_element_name(parsed_element)
      populate_feature_element_description(parsed_element)
    end

    def populate_feature_element_name(parsed_element)
      @name = parsed_element['name']
    end

    def populate_feature_element_description(parsed_element)
      @description = parsed_element['description'].split("\n").collect { |line| line.strip }
      @description.delete('')
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cucumber_analytics-1.0.0 lib/cucumber_analytics/feature_element.rb