Sha256: 2d3d31ac691e1237535c6c3ac6aaa750996b39688c32bb4b07c2490491e83bbe
Contents?: true
Size: 1.03 KB
Versions: 9
Compression:
Stored size: 1.03 KB
Contents
module MasterView # this hash is designed to track modified times of its values # this behaviour is only supported through using []= and store # mechanisms and thus default semantics have been excluded # other update methods such as merge! have been excluded from # this implementation and will raise errors class MTimeTrackingHash < Hash # MTimeTrackingHash does not support defaults and thus does # not take default object or block def initialize super @mtimes = {} end def []=(key, value) update_mtime(key) super end def store(key, value) update_mtime(key) super end # returns the Time object for this key def mtime(key) @mtimes[key] end private def update_mtime(key) @mtimes[key] = Time.now end def default=(obj); raise "Not implemented"; end def merge!(obj,&block); raise "Not implemented"; end def reject!(obj,&block); raise "Not implemented"; end def replace(obj); raise "Not implemented"; end end end
Version data entries
9 entries across 9 versions & 1 rubygems