Skip to content
Browse files

Rack::Offline::Config needs to know about root for default block to work

  • Loading branch information...
1 parent 35deab7 commit ebe5c6d0a779f57e37e75d726575ddeedd239bc0 @twinge twinge committed with Apr 16, 2010
Showing with 7 additions and 2 deletions.
  1. +1 −1 lib/rack/offline.rb
  2. +6 −1 lib/rack/offline/config.rb
View
2 lib/rack/offline.rb
@@ -20,7 +20,7 @@ def initialize(options = {}, &block)
@root = Pathname.new(options[:root] || Dir.pwd)
if block_given?
- @config = Rack::Offline::Config.new(&block)
+ @config = Rack::Offline::Config.new(@root, &block)
end
if @cache
View
7 lib/rack/offline/config.rb
@@ -3,10 +3,11 @@ class Offline
class Config
attr_reader :cached, :network, :fallback
- def initialize(&block)
+ def initialize(root, &block)
@cached = []
@network = []
@fallback = {}
+ @root = root
instance_eval(&block) if block_given?
end
@@ -21,6 +22,10 @@ def network(*names)
def fallback(hash = {})
@fallback.merge(hash)
end
+
+ def root
+ @root
+ end
end
end
end

0 comments on commit ebe5c6d

Please sign in to comment.
Something went wrong with that request. Please try again.