Class: Scrappy::Dumper
- Inherits:
-
Object
- Object
- Scrappy::Dumper
- Defined in:
- lib/scrappy/agent/dumper.rb
Constant Summary collapse
- Mux =
Mutex.new
Class Method Summary collapse
Class Method Details
.dump(uri, triples, format) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/scrappy/agent/dumper.rb', line 5 def self.dump uri, triples, format Mux.synchronize do filename = uri.gsub("http://", "").gsub("https://", "").gsub("/", "-").gsub(".", "_").gsub("?", "+").gsub("&", "+") + ".#{format}" data = RDF::Graph.new(triples).serialize(format) File.open(filename, "w") { |f| f.write data } end end |