Sha256: 48a74d30ae8ea0edc081deb683be77e726f063659e520da291337fb6d9b08556

Contents?: true

Size: 491 Bytes

Versions: 1

Compression:

Stored size: 491 Bytes

Contents

module Maths
  # Public: Represents a number that should be formatted as a percentage
	class Percentage < BigDecimal
    # Pretty much idential to a BigDecimal
    
    # Public: Builds out a fraction by the numerator and denominator
    def self.build(numerator, denominator)
      numerator = BigDecimal.new(numerator.to_s)
      denominator = BigDecimal.new(denominator.to_s)
      puts numerator, denominator
      Percentage.new(((numerator / denominator) * 100).to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maths-0.0.4 lib/maths/percentage.rb