Class: BrBoleto::Helper::Number

Inherits:
Object
  • Object
show all
Defined in:
lib/br_boleto/helper/number.rb

Instance Method Summary collapse

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