Module: Marcopolo

Defined in:
lib/marcopolo.rb,
lib/marcopolo/rails.rb,
lib/marcopolo/version.rb,
lib/marcopolo/middleware.rb

Defined Under Namespace

Classes: Marco, Middleware

Constant Summary collapse

DEFAULT_LOGGER =
Logger.new($stdout)
DEFAULT_OPTIONS =
{
  logger: DEFAULT_LOGGER,
  severity: Logger::Severity::DEBUG,
  filter: Proc.new {|request| true }
}
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.allow(request) ⇒ Object



22
23
24
# File 'lib/marcopolo.rb', line 22

def allow(request)
  options[:filter].call(request)
end

.log(msg) ⇒ Object



18
19
20
# File 'lib/marcopolo.rb', line 18

def log(msg)
  options[:logger].add(options[:severity]) { msg }
end

.optionsObject



14
15
16
# File 'lib/marcopolo.rb', line 14

def options
  @@options ||= DEFAULT_OPTIONS.clone
end