Guest User

Untitled

a guest
Jul 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. def self.parse file
  2. File.open(file){|io|
  3. url = nil
  4. text = nil
  5. next_is_text = false
  6. io.each_line{|line|
  7. if url == nil
  8. url = s.match(/Recno::\s+(.*)/)[1] rescue nil
  9.  
  10. end
  11. if text_is_next
  12. text = line
  13. text_is_next = false
  14. end
  15. if text == nil
  16. text_is_next = true if s.match(/ParseText::/)
  17. #parsetext is the next line
  18. end
  19.  
  20. if url && text
  21. puts url
  22. puts text
  23. url = nil
  24. text = nil
  25. end
  26. }
  27. }
  28. end
Add Comment
Please, Sign In to add comment