Class: WhatTheGem::Stats::Meter

Inherits:
Struct
  • Object
show all
Defined in:
lib/whatthegem/stats/meters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



5
6
7
# File 'lib/whatthegem/stats/meters.rb', line 5

def block
  @block
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/whatthegem/stats/meters.rb', line 5

def name
  @name
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



5
6
7
# File 'lib/whatthegem/stats/meters.rb', line 5

def path
  @path
end

#thresholdsObject

Returns the value of attribute thresholds

Returns:

  • (Object)

    the current value of thresholds



5
6
7
# File 'lib/whatthegem/stats/meters.rb', line 5

def thresholds
  @thresholds
end

Instance Method Details

#call(gem) ⇒ Object



6
7
8
9
# File 'lib/whatthegem/stats/meters.rb', line 6

def call(gem)
  dig(gem, *path)&.then(&block)
    .then { |val| Metric.new(name, val, *thresholds) }
end