Class: BrBoleto::Helper::Number
- Inherits:
-
Object
- Object
- BrBoleto::Helper::Number
- Defined in:
- lib/br_boleto/helper/number.rb
Instance Method Summary collapse
- #formata_valor_monetario(size = 13) ⇒ Object
-
#initialize(numero) ⇒ Number
constructor
A new instance of Number.
Constructor Details
#initialize(numero) ⇒ Number
Returns a new instance of Number.
4 5 6 |
# File 'lib/br_boleto/helper/number.rb', line 4 def initialize(numero) @numero = numero end |
Instance Method Details
#formata_valor_monetario(size = 13) ⇒ Object
8 9 10 11 |
# File 'lib/br_boleto/helper/number.rb', line 8 def formata_valor_monetario(size=13) return ''.rjust(size, '0') if @numero.blank? sprintf('%.2f', @numero).delete('.').rjust(size, '0') end |