class CucumberStatistics::FeatureStatistics

Public Class Methods

new() click to toggle source
# File lib/cucumber_statistics/feature_statistics.rb, line 3
def initialize
  @all = Hash.new
end

Public Instance Methods

all() click to toggle source
# File lib/cucumber_statistics/feature_statistics.rb, line 18
def all
  @all
end
record(feature_name, duration, file) click to toggle source
# File lib/cucumber_statistics/feature_statistics.rb, line 7
def record feature_name, duration, file
  short_file = file[file.index('features').to_i..-1]

  feature_result = @all[short_file]
  feature_result ||= Hash.new
  feature_result[:duration] = duration
  feature_result[:feature_name] = feature_name

  @all[short_file] ||= feature_result
end
sort_by_property(property) click to toggle source
# File lib/cucumber_statistics/feature_statistics.rb, line 22
def sort_by_property property
  result = @all.sort {|a,b| a.last[property.to_sym] <=> b.last[property.to_sym]}
  result
end