class CukeParser::ParseEngine::ParserUtils
Public Instance Methods
dir_purge(dir_path, build_stamp)
click to toggle source
# File lib/parse_engine/parser_utils.rb, line 22 def dir_purge(dir_path, build_stamp) #get rid of directories we already have data for drop_num = 2 if Dir.exists?(dir_path) dir = Dir.entries(dir_path) if build_stamp != "empty" dir.each do |build_folder| if build_folder <= build_stamp drop_num = dir.index(build_folder) + 1 end end end dir = dir.drop(drop_num) return dir else #not a valid directory (does not exist must let App know so User can be notified) return false end end
format_time(time)
click to toggle source
# File lib/parse_engine/parser_utils.rb, line 69 def format_time(time) Time.at(time / 1000000000.00).gmtime.strftime('%R:%S:%L') end
intialize()
click to toggle source
# File lib/parse_engine/parser_utils.rb, line 5 def intialize #nothing yet end
parse_time(datetime)
click to toggle source
# File lib/parse_engine/parser_utils.rb, line 9 def parse_time(datetime) timestamp = Hash['date', datetime[0], 'time', datetime[1], 'runstamp', 0] dt = [] timestamp['date'].split("-").each do |d| dt.push(d.to_i) end timestamp['time'].split("-").each do |t| dt.push(t.to_i) end timestamp['runstamp'] = Time.new(dt[0],dt[1],dt[2],dt[3],dt[4],dt[5]) return timestamp end
pretty(build,file)
click to toggle source
# File lib/parse_engine/parser_utils.rb, line 42 def pretty(build,file) #build is always first line, no indentation needed to make it "pretty" file.puts build.to_csv build.features.each do |feature| file.puts feature.to_csv_pretty feature.scenarios.each do |scenario| file.puts scenario.to_csv_pretty scenario.steps.each do |step| file.puts step.to_csv_pretty end end end end
ugly(build,file)
click to toggle source
# File lib/parse_engine/parser_utils.rb, line 56 def ugly(build,file) file.puts build.to_csv build.features.each do |feature| file.puts feature.to_csv feature.scenarios.each do |scenario| file.puts scenario.to_csv scenario.steps.each do |step| file.puts step.to_csv end end end end