Class: Feedzirra::Backend::Filesystem
- Inherits:
-
Object
- Object
- Feedzirra::Backend::Filesystem
- Defined in:
- lib/feedzirra/backend/filesystem.rb
Constant Summary collapse
- DEFAULTS =
{ :path => File.(File.join(%w[ ~ / .feedzirra ])) }
Instance Method Summary collapse
- #get(url) ⇒ Object
-
#initialize(options = { }) ⇒ Filesystem
constructor
A new instance of Filesystem.
- #set(url, result) ⇒ Object
Constructor Details
#initialize(options = { }) ⇒ Filesystem
Returns a new instance of Filesystem.
12 13 14 |
# File 'lib/feedzirra/backend/filesystem.rb', line 12 def initialize( = { }) @options = DEFAULTS.merge() end |
Instance Method Details
#get(url) ⇒ Object
16 17 18 19 |
# File 'lib/feedzirra/backend/filesystem.rb', line 16 def get(url) f = filename_for(url) Marshal.load(File.read(f)) if File.exist?(f) end |
#set(url, result) ⇒ Object
21 22 23 |
# File 'lib/feedzirra/backend/filesystem.rb', line 21 def set(url, result) File.open(filename_for(url), 'w') {|f| f.write(Marshal.dump(result)) } end |