Sha256: 53f640ad6b9469f8c4adb19f3e6961a86ada81927cef43d148c120a453c3cd1b
Contents?: true
Size: 688 Bytes
Versions: 23
Compression:
Stored size: 688 Bytes
Contents
module ActiveAdminAddons class NumberBuilder < CustomBuilder NUMBER_TYPES = { currency: :number_to_currency, human: :number_to_human, human_size: :number_to_human_size, percentage: :number_to_percentage, phone: :number_to_phone, delimiter: :number_with_delimiter, precision: :number_with_precision } def render options[:as] = options.fetch(:as, :delimiter) if !NUMBER_TYPES.keys.include?(options[:as]) raise "Invalid number type. Options are: #{NUMBER_TYPES.keys}" end context.send(NUMBER_TYPES[options[:as]], data, options) end end end ActiveAdminAddons::NumberBuilder.create_view_methods
Version data entries
23 entries across 23 versions & 2 rubygems