Permalink
Browse files

Make the Config interface more consistent.

The methods Config#fallback and Config#network are used for both setting and
getting values. Make Config#cache do the same.
  • Loading branch information...
1 parent dcb11a0 commit f96d1d83f80b558ab2362802e55cc1a18468451f Jimmy Kittiyachavalit committed with May 17, 2010
Showing with 5 additions and 7 deletions.
  1. +3 −3 lib/rack/offline.rb
  2. +2 −4 lib/rack/offline/config.rb
View
@@ -36,7 +36,7 @@ def call(env)
body = ["CACHE MANIFEST"]
body << "# #{key}"
- @config.cached.each do |item|
+ @config.cache.each do |item|
body << item
end
@@ -62,11 +62,11 @@ def call(env)
private
def precache_key!
- hash = @config.cached.map do |item|
+ hash = @config.cache.map do |item|
Digest::SHA2.hexdigest(@root.join(item).read)
end
@key = Digest::SHA2.hexdigest(hash.join)
end
end
-end
+end
@@ -1,18 +1,16 @@
module Rack
class Offline
class Config
- attr_reader :cached
-
def initialize(root, &block)
- @cached = []
+ @cache = []
@network = []
@fallback = {}
@root = root
instance_eval(&block) if block_given?
end
def cache(*names)
- @cached.concat(names)
+ @cache.concat(names)
end
def network(*names)

0 comments on commit f96d1d8

Please sign in to comment.