Module: Brcobranca::Boleto::Template::RghostCarne

Extended by:
RghostCarne
Includes:
RGhost
Included in:
RghostCarne
Defined in:
lib/brcobranca/boleto/template/rghost_carne.rb

Overview

Templates para usar com Rghost

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Stream

Cria o métodos dinâmicos (to_pdf, to_gif e etc) com todos os fomátos válidos.

Examples:

@boleto.to_pdf #=> boleto gerado no formato pdf

Returns:

  • (Stream)

See Also:

  • Recebe os mesmos parâmetros do Rghost#modelo_carne.


53
54
55
56
57
58
59
60
# File 'lib/brcobranca/boleto/template/rghost_carne.rb', line 53

def method_missing(m, *args)
  method = m.to_s
  if method.start_with?('to_')
    modelo_carne(self, (args.first || {}).merge!(formato: method[3..]))
  else
    super
  end
end

Instance Method Details

#lote_carne(boletos, options = {}) ⇒ Stream

Gera o boleto em usando o formato desejado [:pdf, :jpg, :tif, :png, :ps, :laserjet, … etc]

Returns:

  • (Stream)

See Also:



43
44
45
# File 'lib/brcobranca/boleto/template/rghost_carne.rb', line 43

def lote_carne(boletos, options = {})
  modelo_carne_multipage(boletos, options)
end

#to_carne(formato, options = {}) ⇒ Stream

Gera o boleto em usando o formato desejado [:pdf, :jpg, :tif, :png, :ps, :laserjet, … etc]

Returns:

  • (Stream)

See Also:



34
35
36
# File 'lib/brcobranca/boleto/template/rghost_carne.rb', line 34

def to_carne(formato, options = {})
  modelo_carne(self, options.merge!(formato: formato))
end