Sha256: dddcd7a18188678e8eb4d117744420762f74e56ade3d6b0daa1cd832f46887c5
Contents?: true
Size: 972 Bytes
Versions: 6
Compression:
Stored size: 972 Bytes
Contents
require 'yaml' module Pho #Simple mechanism for managing etags class Etags attr_reader :file, :saved def initialize(file = nil) @file = file @saved = true @tags = Hash.new if @file != nil @tags = YAML::load(@file)[0] end end def save(other=nil) if (other != nil) other.write( @tags.to_yaml() ) return else if (!saved && @file != nil ) @file.write( @tags.to_yaml() ) @file.close end end end def add(uri, tag) if (uri != nil && tag != nil) @tags[uri] = tag @saved = false end end def add_from_response(uri, response) add(uri, response.header["ETag"][0]) end def get(uri) return @tags[uri] end def has_tag?(uri) return @tags.has_key?(uri) end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
pho-0.0.1 | lib/pho/etags.rb |
pho-0.1 | lib/pho/etags.rb |
pho-0.2 | lib/pho/etags.rb |
pho-0.3 | lib/pho/etags.rb |
pho-0.4 | lib/pho/etags.rb |
pho-0.4.1 | lib/pho/etags.rb |