Class: Rspider::ContentStorage
- Inherits:
-
Hash
- Object
- Hash
- Rspider::ContentStorage
- Defined in:
- lib/rspider/ContentStorage.rb
Overview
this class store the content of documents in Hash (memory) So program uses lots of memory and can play fast
Instance Method Summary collapse
-
#add(url, content) ⇒ Object
store an url and content of the url.
-
#close ⇒ Object
close the db.
-
#get(url) ⇒ Object
get the content of url #url.
-
#initialize ⇒ ContentStorage
constructor
A new instance of ContentStorage.
-
#urls ⇒ Object
list the urls.
Constructor Details
#initialize ⇒ ContentStorage
Returns a new instance of ContentStorage.
15 16 |
# File 'lib/rspider/ContentStorage.rb', line 15 def initialize() end |
Instance Method Details
#add(url, content) ⇒ Object
store an url and content of the url
18 19 20 |
# File 'lib/rspider/ContentStorage.rb', line 18 def add(url,content) self[url]=content end |
#close ⇒ Object
close the db
26 27 |
# File 'lib/rspider/ContentStorage.rb', line 26 def close end |
#get(url) ⇒ Object
get the content of url #url
29 30 31 |
# File 'lib/rspider/ContentStorage.rb', line 29 def get(url) return self[url] end |
#urls ⇒ Object
list the urls
22 23 24 |
# File 'lib/rspider/ContentStorage.rb', line 22 def urls self.keys end |