Class: ReeNumber::NumberToPercentage
- Inherits:
-
Object
- Object
- ReeNumber::NumberToPercentage
- Includes:
- Ree::FnDSL
- Defined in:
- lib/ree_lib/packages/ree_number/package/ree_number/functions/number_to_percentage.rb
Constant Summary collapse
- DEFAULTS =
{ format: "%n%", precision: 3, significant: false, strip_insignificant_zeros: false, delimiter: "", round_mode: :default }.freeze
Instance Method Summary collapse
Instance Method Details
#call(number, **opts) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ree_lib/packages/ree_number/package/ree_number/functions/number_to_percentage.rb', line 42 def call(number, **opts) = DEFAULTS.merge(opts) rounded_number = number_to_rounded( number, **slice( , [:precision, :significant, :strip_insignificant_zeros, :round_mode] ) ) [:format].gsub("%n", rounded_number) end |