class CucumberFM::Aggregator

Public Class Methods

new(cfm, aggregator, multiple = false) click to toggle source
# File lib/cucumber_f_m/aggregator.rb, line 3
def initialize(cfm, aggregator, multiple = false)
  if multiple
    @collection = Collection.nested_hash(0)
    multiple.each do |tag|
      cfm.scenarios.each do |scenario|
        @collection[tag].push scenario if scenario.tags.include?(tag)
      end
    end
  else
    @collection = Collection.nested_hash(aggregator.size)
    if aggregator.size == 2
      cfm.scenarios.each do |scenario|
        @collection[label(aggregator.first, scenario.tags_without_technical)][label(aggregator.last, scenario.tags_without_technical)][scenario.feature].push scenario
      end
    else
      @collection = Collection.nested_hash(1)
      cfm.scenarios.each do |scenario|
        @collection[label(aggregator.first, scenario.tags_without_technical)][scenario.feature].push scenario
      end
    end
  end
end

Public Instance Methods

collection() click to toggle source
# File lib/cucumber_f_m/aggregator.rb, line 26
def collection
  @collection
end

Private Instance Methods

label(aggregate, tags) click to toggle source
# File lib/cucumber_f_m/aggregator.rb, line 32
def label(aggregate, tags)
  tags.find { |tag| tag =~ aggregate } || '_undefined_'
end