lib/numerology.rb in numerology-0.0.2 vs lib/numerology.rb in numerology-0.0.3

- old
+ new

@@ -1,12 +1,19 @@ require "numerology/version" module Numerology def format_like(example) + if example.gsub(/\D/,'') =~ /(0+$)/ + sig_fig = $1.length + temp = self.round(sig_fig*-1) + else + temp = self + end + if example =~ /^[0\s]/ - formatted_string = "%#{example[0]}#{example.gsub(/\D/,'').length}d" % self + formatted_string = "%#{example[0]}#{example.gsub(/\D/,'').length}d" % temp else - formatted_string = self.to_s + formatted_string = temp.to_s end formatted_string = separate_thousands(formatted_string, example[-4]) if example =~ /(\D)\d{3}$/ formatted_string \ No newline at end of file