brewersfan1976

task_maker.rb

Jun 4th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.62 KB | None | 0 0
  1. def taskMaker(source, challengeId)
  2.     array = Array.new
  3.     source_length = source.length
  4.     x = 0
  5.     y = 0
  6.    
  7.     while (x < source_length)
  8.           if source[x].include?("//") == false then
  9.              array[y] = source[x]
  10.              y = y + 1
  11.           else
  12.              if source[x].include?("//DB " + challengeId.to_s + "//") == true then
  13.                 string = "//DB " + challengeId.to_s + "//"
  14.                 array[y - 1] = source[x]
  15.                 array[y - 1].gsub! string, ''
  16.              end
  17.            end
  18.              
  19.            x = x + 1
  20.     end
  21.              
  22.     return array
  23. end
Advertisement
Add Comment
Please, Sign In to add comment