Sha256: 73476e7be9c66671e5b4ca4fe6959100adb339b1987d7f5df0a779da63e83f1b

Contents?: true

Size: 270 Bytes

Versions: 2

Compression:

Stored size: 270 Bytes

Contents

# frozen_string_literal: true

module Percentify
  module CoreExtensions
    module Numeric
      def as_percentage_of(number)
        (to_f / number.to_f) * 100
      end

      def percent_of(number)
        (to_f / 100.to_f) * number.to_f
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
percentify-0.1.1 lib/percentify/core_extensions/numeric.rb
percentify-0.1.0 lib/percentify/core_extensions/numeric.rb