class WhatTheGem::Stats::Meter
Public Instance Methods
call(gem)
click to toggle source
# File lib/whatthegem/stats/meters.rb, line 6 def call(gem) dig(gem, *path)&.then(&block) .then { |val| Metric.new(name, val, *thresholds) } end
Private Instance Methods
dig(value, first = nil, *rest)
click to toggle source
# File lib/whatthegem/stats/meters.rb, line 13 def dig(value, first = nil, *rest) return value unless first case value when nil value when ->(v) { first.is_a?(Symbol) && v.respond_to?(first) } dig(value.public_send(first), *rest) when Hash, Array value.dig(first, *rest) else fail "Can't dig #{first} in #{value}" end end