In my code, I have a section that extracts and lists the different categories of posts but my problem is how to get exactly the posts that fall within that category and list them only. This is an example of my code:
category = Array.new
docs.elements.each("*/entry/category") { |element|
category << element.attributes['term']}
title = Array.new
docs.elements.each("*/entry/title") do |element|
title << element.text
end
category.each_with_index {|category, index|
puts " For Catergory : #{category}
The title is : #{title[index]} "
puts '---------------------------------------------------'
The output of the above code is as follows and I would want to match like categories with their titles.
For Catergory : A good Begining
The title is : Today
For Catergory : Circular
The title is : Life
For Catergory : Circular
The title is : Let Me try
For Catergory : A good Begining
The title is : Check
For Catergory : time shall time
The title is : Testing
For Catergory : time shall time
The title is : I have made it
For Catergory : Circular
The title is : I have made it
For Catergory : Circular
The title is : Me
For Catergory : A good Begining
The title is : A Remarkable move
For Catergory : time shall time
The title is :
For Catergory : A good Begining
The title is : A welcome note