class MaintenanceMode

Constants

VERSION

Attributes

persistence[W]

Public Class Methods

as_json() click to toggle source
# File lib/maintenance_mode.rb, line 14
def as_json
  {
    enabled: enabled?,
    message: message,
  }
end
persist_with(persistence_method, *args, &block) click to toggle source
# File lib/maintenance_mode.rb, line 27
def persist_with(persistence_method, *args, &block)
  self.persistence = persistence_methods.fetch(persistence_method).new(*args, &block)
end
persistence() click to toggle source
# File lib/maintenance_mode.rb, line 23
def persistence
  @persistence || NullPersistence.new
end
register_persistence_method(name, persistence_method_class) click to toggle source
# File lib/maintenance_mode.rb, line 31
def register_persistence_method(name, persistence_method_class)
  persistence_methods[name] = persistence_method_class
end
reset() click to toggle source
# File lib/maintenance_mode.rb, line 35
def reset
  @persistence_methods = nil
  @persistence = nil
end

Private Class Methods

persistence_methods() click to toggle source
# File lib/maintenance_mode.rb, line 42
def persistence_methods
  @persistence_methods ||= {
    file: FilePersistence
  }
end