Module: BrBoleto::StringMethods

Defined in:
lib/br_boleto/string_methods.rb

Instance Method Summary collapse

Instance Method Details

#adjust_size_to(size, adjust = " ", orientation = :left) ⇒ Object

para o tamanho passado se a string for menor, adiciona espacos a direita se a string for maior, trunca para o num. de caracteres



9
10
11
12
13
14
15
16
17
# File 'lib/br_boleto/string_methods.rb', line 9

def adjust_size_to(size, adjust=" ", orientation=:left)
	if self.size > size
		truncate(size, omission: '')
	elsif orientation == :left
		ljust(size, adjust)
	else
		rjust(size, adjust)				
	end
end

#only_numbersObject



19
20
21
# File 'lib/br_boleto/string_methods.rb', line 19

def only_numbers
	self.gsub(/[^\d]/, '')
end