class Rets::Metadata::FileCache
This metadata cache persists the metadata to a file.
Public Class Methods
new(path)
click to toggle source
# File lib/rets/metadata/file_cache.rb, line 7 def initialize(path) @path = path end
Public Instance Methods
load(&block)
click to toggle source
Load the metadata. Should yield an IO-like object to a block; that block will deserialize the metadata from that object and return the metadata. Returns the metadata, or nil if it could not be loaded.
# File lib/rets/metadata/file_cache.rb, line 21 def load(&block) File.open(@path, "rb", &block) rescue IOError, SystemCallError nil end
save(&block)
click to toggle source
Save the metadata. Should yield an IO-like object to a block; that block will serialize the metadata to that object.
# File lib/rets/metadata/file_cache.rb, line 13 def save(&block) File.open(@path, "wb", &block) end