Class: Interage::ParserCPF
- Inherits:
-
Object
- Object
- Interage::ParserCPF
- Includes:
- NumberHelper
- Defined in:
- lib/interage/parsers/parser_cpf.rb
Constant Summary collapse
- ALLOWED_SIZE =
11
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cpf) ⇒ ParserCPF
constructor
A new instance of ParserCPF.
- #perform ⇒ Object
Methods included from NumberHelper
#default_currency_format, #only_numbers
Constructor Details
#initialize(cpf) ⇒ ParserCPF
Returns a new instance of ParserCPF.
13 14 15 |
# File 'lib/interage/parsers/parser_cpf.rb', line 13 def initialize(cpf) @cpf = only_numbers(cpf).to_i end |
Class Method Details
.call(cpf) ⇒ Object
9 10 11 |
# File 'lib/interage/parsers/parser_cpf.rb', line 9 def self.call(cpf) new(cpf).perform end |
Instance Method Details
#perform ⇒ Object
17 18 19 |
# File 'lib/interage/parsers/parser_cpf.rb', line 17 def perform "#{prefix_cpf}-#{sufix_cpf}".strip if cpf.positive? end |