lib/comparison/presenter.rb
##
# Returns Comparator#relative formatted as a percentage.
#
# If the relative percentage evaluates to Infinity or -Infinity, +nil+ is
# returned. If it evaluates to NaN, 0 is returned.
Returns Comparator#relative formatted as a percentage.
If the relative percentage evaluates to Infinity or -Infinity, +nil+ is
returned. If it evaluates to NaN, 0 is returned.
Returns Comparator#relative formatted as a percentage . If the relative percentage evaluates to Infinity or - Infinity + nil + is returned . If it evaluates to NaN 0 is returned .
def percentage(**options)
      if nan? || zero?
        number_to_percentage 0, **options
      elsif infinite?
        t 'comparison.infinity_html', default: nil
      elsif positive?
        number_to_percentage relative, format: '+%n%', **options
      else
        number_to_percentage relative, **options
      end
    end
def percentage ( ** options ) if nan? || zero? number_to_percentage 0 , ** options elsif infinite? t 'comparison.infinity_html' , default : nil elsif positive? number_to_percentage relative , format : '+%n%' , ** options else number_to_percentage relative , ** options end end
Returns Comparator#relative formatted as a percentage.
Returns Comparator#relative formatted as a percentage .
options
<not_specific>