class TookeUtils::General
Public Class Methods
only_numbers(str)
click to toggle source
# File lib/tooke_utils/general.rb, line 17 def self.only_numbers str str.gsub(/[^0-9]/, '') end
to_block_of_strings(str)
click to toggle source
# File lib/tooke_utils/general.rb, line 7 def self.to_block_of_strings str if CPF.is_cpf? str /([0-9]{3})\.([0-9]{3})\.([0-9]{3})\-([0-9]{2})/.match str elsif CNPJ.is_cnpj? str /([0-9]{2})\.([0-9]{3})\.([0-9]{3})\/([0-9]{4})\-([0-9]{2})/.match str else nil end end