Hello,
 I have bug tracker written for my team and recently facing an issue do
 to some changes in the original web page.
 I kind of scrap of all the bugs from a webpage and add them to my own
 database and do some manipulations later by adding some new columns.

 This is the piece of code I need help with --
    page = agent.get(url)
    table = agent.page.search('//*[(@id = "subreport_list")]//
 td').map(&:text).map(&:strip)
    table = table.split('Bug')

 I'm using it to parse the below page --

 (Original web page)

 Bug     118096-M00              P3              S3      New
2011/05/20      54      54      sjalalud        suzeng  SW: MG
 GTP     Delete Bearer Request shall not be sent with bearer ID 0.
7x50 MG
 0.0
 Task    118749-M00              P2              S4      New
2011/06/02      41      28      suzeng  suzeng  SW: MG GTP
 CSFB support in GTP     7x50 MG 0.0
 Bug     119810-M00              P2              S2      New
2011/06/21      22      8       dkothapa        suzeng  SW: MG
 Assertion "FALSE" failed in redDynamicTaskProcessIccData while scaling
 up to 180k bearers when path management went down on s11 and s5 7x50
 MG 0.0
 Bug     120251-M00              P2              S2      New
2011/06/28      14      13      sairams suzeng  SW: MG
 First ue gets deleted when second UE takes the same IP. 7x50 MG 0.0

 After split this in #{table} --

 ["118096-M00", "", "P3", "", "S3", "New", "2011/05/20", "54", "54",
 "sjalalud", "suzeng", "SW: MG GTP", "Delete Bearer Request shall not
 be sent with bearer ID 0.", "7x50 MG 0.0", "Task", "118749-M00", "",
 "P2", "", "S4", "New", "2011/06/02", "41", "29", "suzeng", "suzeng",
 "SW: MG GTP", "CSFB support in GTP", "7x50 MG 0.0"],

  ["119810-M00", "", "P2", "", "S2", "New", "2011/06/21", "22", "8",
 "dkothapa", "suzeng", "SW: MG", "Assertion \"FALSE\" failed in
 redDynamicTaskProcessIccData while scaling up to 180k bearers when
 path management went down on s11 and s5", "7x50 MG 0.0"],

 ["120251-M00", "", "P2", "", "S2", "New", "2011/06/28", "14", "13",
 "sairams", "suzeng", "SW: MG", "First ue gets deleted when second UE
 takes the same IP.", "7x50 MG 0.0"],



 In the above result, You can see the first row will start with 118096
 (which is the first Bug) but "Task" should be a separate row by
 itself. That is what I want to do. when I do table.each -

 ["118096-M00", "", "P3", "", "S3", "New", "2011/05/20", "54", "54",
 "sjalalud", "suzeng", "SW: MG GTP", "Delete Bearer Request shall not
 be sent with bearer ID 0.", "7x50 MG 0.0"],

 ["Task", "118749-M00", "", "P2", "", "S4", "New", "2011/06/02", "41",
 "29", "suzeng", "suzeng", "SW: MG GTP", "CSFB support in GTP", "7x50
 MG 0.0"],

  ["119810-M00", "", "P2", "", "S2", "New", "2011/06/21", "22", "8",
 "dkothapa", "suzeng", "SW: MG", "Assertion \"FALSE\" failed in
 redDynamicTaskProcessIccData while scaling up to 180k bearers when
 path management went down on s11 and s5", "7x50 MG 0.0"],

 ["120251-M00", "", "P2", "", "S2", "New", "2011/06/28", "14", "13",
 "sairams", "suzeng", "SW: MG", "First ue gets deleted when second UE
 takes the same IP.", "7x50 MG 0.0"],


 I should see 4 rows, Task being the second row. How can I modify my
 split command to work this way. I was not able to figure this out..

 Really appreciate the help
 Tnx
 A

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to