Class: ActiveAdminAddons::NumberBuilder
- Inherits:
-
CustomBuilder
- Object
- CustomBuilder
- ActiveAdminAddons::NumberBuilder
- Defined in:
- lib/activeadmin_addons/addons/number_builder.rb
Constant Summary collapse
- 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 }
Instance Attribute Summary
Attributes inherited from CustomBuilder
#args, #block, #context, #model
Instance Method Summary collapse
Methods inherited from CustomBuilder
builder_method_name, create_view_methods, #initialize
Constructor Details
This class inherits a constructor from ActiveAdminAddons::CustomBuilder
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/activeadmin_addons/addons/number_builder.rb', line 13 def render [:as] = .fetch(:as, :delimiter) if !NUMBER_TYPES.keys.include?([:as]) raise "Invalid number type. Options are: #{NUMBER_TYPES.keys}" end context.send(NUMBER_TYPES[[:as]], data, ) end |