Sha256: d97442fd118665853827d02a35bde35c12ec051e5566c9be586c3e0ebeba68e1
Contents?: true
Size: 1.54 KB
Versions: 22
Compression:
Stored size: 1.54 KB
Contents
# frozen_string_literal: true require 'action_view/helpers/number_helper' class Numeric DEFAULT_PRECISION = 2 class << self # @return [Object] A object that extends [ActionView::Helpers::NumberHelper] def number_helper @number_helper ||= begin r = ::Object.new r.extend(::ActionView::Helpers::NumberHelper) r end end end def default_precision_options(options = {}) r = options.dup r[:precision] = DEFAULT_PRECISION r end # @return [Object] A object that extends [ActionView::Helpers::NumberHelper] def number_helper self.class.number_helper end # @return [String] def to_currency(options = {}) number_helper.number_to_currency(self, default_precision_options(options)) end # @return [String] def to_human(options = {}) number_helper.number_to_human(self, default_precision_options(options)) end # @return [String] def to_human_size(options = {}) number_helper.number_to_human_size(self, default_precision_options(options)) end # @return [String] def to_percentage(options = {}) number_helper.number_to_percentage(self, default_precision_options(options)) end # @return [String] def to_phone(options = {}) number_helper.number_to_phone(self, options) end # @return [String] def with_delimiter(options = {}) number_helper.number_with_delimiter(self, options) end # @return [String] def with_precision(options = {}) number_helper.number_with_precision(self, default_precision_options(options).print_debug) end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
eac_rails_utils-0.15.1 | lib/eac_rails_utils/patches/numeric/number_helper.rb |
eac_rails_utils-0.15.0 | lib/eac_rails_utils/patches/numeric/number_helper.rb |