Created
April 18, 2012 16:44
-
-
Save kei-s/2414927 to your computer and use it in GitHub Desktop.
Channel data from TwitterIRCGateway to tig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'nokogiri' | |
doc = Nokogiri::XML(File.read('./Groups.xml')) | |
result = doc.search('Group').map{|g| | |
{g: g.search('Name').text, ms: g.search('Members string').map(&:text)} | |
} | |
json = {} | |
result.map{|g|g[:ms]}.flatten.uniq.map{|u| | |
json[u] = result.select{|g|g[:ms].include? u}.map{|g|g[:g]} | |
} | |
puts json.to_json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment