lib/fractional.rb in fractional-1.1.0 vs lib/fractional.rb in fractional-1.2.0

- old
+ new

@@ -37,11 +37,15 @@ to_join = [] if whole_part != 0 to_join << whole_part.to_s end if fractional_part != 0 - to_join << fractional_part.abs.to_s + if whole_part != 0 + to_join << fractional_part.abs.to_s + else + to_join << fractional_part.to_s + end end to_join.join(" ") else @value.to_s end @@ -239,11 +243,11 @@ sign_prefix + amount.to_s end end end - # Display numbers in human-readable manner. - # Examples: 0.5 -> 1/2, 2.333 -> 2 1/3, 0.666 -> 2/3 etc. + # Display numbers in human-readable manner. + # Examples: 0.5 -> 1/2, 2.333 -> 2 1/3, 0.666 -> 2/3 etc. # def self.round_to_human_fraction(value) numeric_to_mixed_number value.rationalize(Rational('0.01')) end