class Sqreen::Rules::BindingAccessorCounter
Count 1 for each things located by the binding accessor
Public Class Methods
new(klass, method, rule_hash)
click to toggle source
Calls superclass method
# File lib/sqreen/rules/count_http_codes.rb, line 29 def initialize(klass, method, rule_hash) super(klass, method, rule_hash) @accessors = @data['values'].map do |expr| BindingAccessor.new(expr, true) end @metric_category = rule_hash[Attrs::METRICS].first['name'] end
Public Instance Methods
post(rv, inst, args, _budget = nil, &_block)
click to toggle source
# File lib/sqreen/rules/count_http_codes.rb, line 37 def post(rv, inst, args, _budget = nil, &_block) return unless rv.is_a?(Array) && !rv.empty? key = @accessors.map do |accessor| accessor.resolve(binding, framework, inst, args, @data, rv) end record_observation(@metric_category, SafeJSON.dump(key), 1) advise_action(nil) end