Class: VerificadorBoletoBr::Slip::Bank::CodeAssembly
- Inherits:
-
Object
- Object
- VerificadorBoletoBr::Slip::Bank::CodeAssembly
- Includes:
- Calculus::Module10, Calculus::Module11
- Defined in:
- lib/verificador_boleto_br/slip/bank/code_assembly.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
Instance Method Summary collapse
- #digitable_line ⇒ Object
-
#initialize(code) ⇒ CodeAssembly
constructor
A new instance of CodeAssembly.
Methods included from Calculus::Module11
Methods included from Calculus::Module10
Constructor Details
#initialize(code) ⇒ CodeAssembly
Returns a new instance of CodeAssembly.
10 11 12 |
# File 'lib/verificador_boleto_br/slip/bank/code_assembly.rb', line 10 def initialize(code) @code = code end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
8 9 10 |
# File 'lib/verificador_boleto_br/slip/bank/code_assembly.rb', line 8 def code @code end |
Instance Method Details
#digitable_line ⇒ Object
14 15 16 17 18 19 |
# File 'lib/verificador_boleto_br/slip/bank/code_assembly.rb', line 14 def digitable_line block_1 = code[0..3] + code[19..23] + modulo10(code[0..3] + code[19..23]).to_s block_2 = code[24..33] + modulo10(code[24..33]).to_s block_3 = code[34..-1] + modulo10(code[34..-1]).to_s block_1 + block_2 + block_3 + code[4..18] end |