Skip to content

Instantly share code, notes, and snippets.

@sinsoku
Created August 16, 2012 14:38
Show Gist options
  • Save sinsoku/3370590 to your computer and use it in GitHub Desktop.
Save sinsoku/3370590 to your computer and use it in GitHub Desktop.
gruff patch for ruby 1.9.3
# config/initializers/gruff/base.rb
module Gruff
class Base
def label_with_ruby193(value)
if @marker_count.to_f == 0
label = value.to_i.to_s
parts = label.split('.')
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{THOUSAND_SEPARATOR}")
parts.join('.')
else
label_without_ruby193(value)
end
end
alias_method_chain :label, :ruby193
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment