class Rack::Downtime::Strategy::File
Attributes
path[W]
Public Class Methods
new(path = nil)
click to toggle source
# File lib/rack/downtime/strategy.rb, line 87 def initialize(path = nil) @path = path || self.class.path @mtime = 0 end
path()
click to toggle source
# File lib/rack/downtime/strategy.rb, line 82 def path @path ||= "downtime.txt" end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack/downtime/strategy.rb, line 92 def call(env) return unless ::File.exists?(@path) new_mtime = ::File.mtime(@path).to_i if new_mtime > @mtime @downtime = parse_downtime(@path) @mtime = new_mtime end @downtime end
Private Instance Methods
parse_downtime(path)
click to toggle source
# File lib/rack/downtime/strategy.rb, line 106 def parse_downtime(path) Rack::Downtime::Utils.parse_downtime(::File.read(path)) end