Created
March 19, 2009 08:24
-
-
Save leandro/81647 to your computer and use it in GitHub Desktop.
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
module RIndexer | |
RE_TAG = %r!<([a-z\d_-]+)\s*.*?>!im | |
def fetch_tags(doc_stream) | |
tags = Hash.new(0) | |
doc_stream.scan(RE_TAG).each do |e| | |
tags[e] += 1 | |
end | |
tags | |
end | |
end | |
include RIndexer | |
arg = ARGV.shift | |
p fetch_tags(IO.read(arg)) | |
#USAGE: ruby teste.rb document.xml (or html, etc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment