Class: VerificadorBoletoBr::Slip::Arrecadation::CodeAssembly
- Inherits:
-
Object
- Object
- VerificadorBoletoBr::Slip::Arrecadation::CodeAssembly
- Includes:
- Calculus::Module10, Calculus::Module11
- Defined in:
- lib/verificador_boleto_br/slip/arrecadation/code_assembly.rb
Instance Method Summary collapse
- #bacen_module ⇒ Object
- #digitable_line ⇒ Object
-
#initialize(code) ⇒ CodeAssembly
constructor
A new instance of CodeAssembly.
- #treated_code ⇒ Object
- #treated_group ⇒ Object
Methods included from Calculus::Module11
Methods included from Calculus::Module10
Constructor Details
#initialize(code) ⇒ CodeAssembly
Returns a new instance of CodeAssembly.
9 10 11 |
# File 'lib/verificador_boleto_br/slip/arrecadation/code_assembly.rb', line 9 def initialize(code) @code = code end |
Instance Method Details
#bacen_module ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/verificador_boleto_br/slip/arrecadation/code_assembly.rb', line 29 def bacen_module case treated_code[2] when '6' 'modulo10' when '7' 'modulo10' when '8' 'modulo11' when '9' 'modulo11' end end |
#digitable_line ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/verificador_boleto_br/slip/arrecadation/code_assembly.rb', line 21 def digitable_line result = "" treated_group.each do |group| result += group + send(bacen_module, group).to_s end result end |
#treated_code ⇒ Object
17 18 19 |
# File 'lib/verificador_boleto_br/slip/arrecadation/code_assembly.rb', line 17 def treated_code treated_group.map {|partial| partial << "0" }.join end |
#treated_group ⇒ Object
13 14 15 |
# File 'lib/verificador_boleto_br/slip/arrecadation/code_assembly.rb', line 13 def treated_group @code.scan(/.{1,11}/m) end |