Guest User

Untitled

a guest
May 27th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. s = "widget_1;widget_3;widget_2;|widget_5|"
  2. column = {}
  3. position = {}
  4.  
  5. tmp_col = s.split("|")
  6. tmp_col.each_index do |i|
  7. tmp_pos = tmp_col[i].split(";")
  8. tmp_pos.each_index do |j|
  9. position[tmp_pos[j]] = j
  10. column[tmp_pos[j]] = i
  11. end
  12. end
  13.  
  14. puts column["widget_5"]
  15. puts position["widget_5"]
  16.  
  17. puts column["lol"]
  18. puts position["lol"]
Add Comment
Please, Sign In to add comment