Sha256: 31d6091bdaea2075fbd28449b21e256478a8d629f796f40976139304e89a5c4e

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents


module YARD::CodeObjects::Cucumber

  class ScenarioOutline < NamespaceObject

    attr_accessor :value, :comments, :keyword, :description, :steps, :tags, :feature
    attr_accessor :scenarios, :examples

    def initialize(namespace,name)
      super(namespace,name.to_s.strip)
      @comments = @description = @value = @feature = nil
      @steps = []
      @tags = []
      @scenarios = []
      @examples = {}
    end

    def background?
      false
    end

    def outline?
      true
    end

    def example_keyword
      @examples[:keyword]
    end
    
    def example_headers
      @examples[:rows].first
    end
    
    def example_data
      @examples[:rows][1..-1]
    end

    def example_values_for_row(row)
      hash = {}

      example_headers.each_with_index do |header,index|
        hash[header] = example_data[row][index]
      end

      hash
    end
    
    def example_hash
      hash = {}
      
      @examples[:rows].each_with_index do |header,index|
        hash[header] = @examples[:rows].collect {|row| row[index] }
      end
      
      hash
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-in-the-yard-1.7.2 lib/yard/code_objects/cucumber/scenario_outline.rb
cucumber-in-the-yard-1.7.1 lib/yard/code_objects/cucumber/scenario_outline.rb