class Sqreen::Weave::Budget

Attributes

current[R]
ratio[R]
threshold[R]

Public Class Methods

new(threshold, ratio = nil) click to toggle source
# File lib/sqreen/weave/budget.rb, line 12
def initialize(threshold, ratio = nil)
  @threshold = threshold
  @ratio = ratio
end
update(opts = nil) click to toggle source
# File lib/sqreen/weave/budget.rb, line 35
def update(opts = nil)
  Sqreen::Weave.logger.info("budget update:#{opts.inspect}")

  return @current = nil if opts.nil? || opts.empty?

  threshold = opts[:threshold]
  ratio = opts[:ratio]

  @current = new(threshold, ratio)
end

Public Instance Methods

dynamic?() click to toggle source
# File lib/sqreen/weave/budget.rb, line 21
def dynamic?
  threshold && ratio
end
static?() click to toggle source
# File lib/sqreen/weave/budget.rb, line 17
def static?
  threshold && !ratio
end
to_h() click to toggle source
# File lib/sqreen/weave/budget.rb, line 28
def to_h
  { threshold: threshold, ratio: ratio }
end