travis-ci
1068 of 1068 new or added lines in 37 files covered. (100.0%)
1372 of 1427 relevant lines covered (96.15%)
84.57 hits per line
|
require "fm_layout/fm_layout"
|
1✔ |
|
require "fm_layout/recibo_pago"
|
1✔ |
|
require "fm_layout/pago"
|
1✔ |
4 |
|
|
|
module FmLayout |
1✔ |
|
class FmLayoutPago < FmLayout |
1✔ |
|
def initialize |
1✔ |
|
super
|
77✔ |
|
@encabezado = ReciboPago.new |
77✔ |
|
@pagos = []
|
77✔ |
|
@num_pago = 0 |
77✔ |
12 |
end
|
|
13 |
|
|
|
def pago |
1✔ |
|
@num_pago += 1 |
136✔ |
|
pago = Pago.new @num_pago |
136✔ |
|
if block_given?
|
136✔ |
|
yield(pago) if block_given? |
136✔ |
|
@pagos << pago
|
136✔ |
20 |
else
|
|
|
pago |
× |
22 |
end
|
|
23 |
end
|
|
24 |
|
|
|
def to_h |
1✔ |
|
super.merge(obtener_hash_pago)
|
67✔ |
27 |
end
|
|
28 |
|
|
|
def to_s |
1✔ |
|
salida = super
|
10✔ |
|
salida += @pagos.map(&:to_s).reduce(:+).to_s |
10✔ |
|
salida |
10✔ |
33 |
end
|
|
34 |
|
|
|
private |
1✔ |
36 |
|
|
|
def obtener_hash_pago |
1✔ |
|
{ 'Pagos' => @pagos.map(&:to_h) } |
67✔ |
39 |
end
|
|
40 |
end
|
|
41 |
end
|