lib/tabs/config.rb in tabs-0.9.1 vs lib/tabs/config.rb in tabs-1.0.0

- old
+ new

@@ -20,11 +20,46 @@ def redis @redis ||= Redis.new end - def register_resolution(resolution, klass) - Tabs::Resolution.register(resolution, klass) + def prefix=(arg) + @prefix = arg + end + + def prefix + @prefix + end + + def register_resolution(klass) + Tabs::Resolution.register(klass) + end + + def unregister_resolutions(*resolutions) + Tabs::Resolution.unregister(resolutions) + end + + def expiration_settings + @expiration_settings ||= {} + end + + def set_expirations(resolution_hash) + resolution_hash.each do |resolution, expires_in_seconds| + raise Tabs::ResolutionMissingError.new(resolution) unless Tabs::Resolution.all.include? resolution + expiration_settings[resolution] = expires_in_seconds + end + end + + def expires?(resolution) + expiration_settings.has_key?(resolution) + end + + def expires_in(resolution) + expiration_settings[resolution] + end + + def reset_expirations + @expiration_settings = {} end end end