Class: Teodoro::ArquivoXML
- Inherits:
-
Object
- Object
- Teodoro::ArquivoXML
- Defined in:
- lib/teodoro/arquivo_xml.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- TIPOS_DE_EVENTO_PROCESSAVEIS =
%w[ S1000 S1005 S1010 S1020 S1030 S1040 S1050 S1070 S2190 S2200 S2205 S2206 S2230 S2250 S2299 S2300 S2306 S2399 S3000 ].freeze
- TIPOS_DE_EVENTO_RETIFICAVEIS =
%w[ S2200 S2205 S2206 S2230 S2250 S2299 S2300 S2306 S2399 ].freeze
Instance Attribute Summary collapse
-
#momento_de_processamento_pelo_e_social ⇒ Object
readonly
Returns the value of attribute momento_de_processamento_pelo_e_social.
-
#numero_do_recibo_a_retificar ⇒ Object
readonly
Returns the value of attribute numero_do_recibo_a_retificar.
Instance Method Summary collapse
-
#carregar ⇒ Object
otimizacao do gerenciamento de memoria.
- #nome ⇒ Object
- #processar ⇒ Object
- #processavel? ⇒ Boolean
- #retificacao? ⇒ Boolean
Instance Attribute Details
#momento_de_processamento_pelo_e_social ⇒ Object (readonly)
Returns the value of attribute momento_de_processamento_pelo_e_social.
56 57 58 |
# File 'lib/teodoro/arquivo_xml.rb', line 56 def @momento_de_processamento_pelo_e_social end |
#numero_do_recibo_a_retificar ⇒ Object (readonly)
Returns the value of attribute numero_do_recibo_a_retificar.
56 57 58 |
# File 'lib/teodoro/arquivo_xml.rb', line 56 def numero_do_recibo_a_retificar @numero_do_recibo_a_retificar end |
Instance Method Details
#carregar ⇒ Object
otimizacao do gerenciamento de memoria
59 60 61 62 63 64 65 66 67 |
# File 'lib/teodoro/arquivo_xml.rb', line 59 def carregar Console.print "carregando #{nome}.xml..." do evento, recibo = carregar_evento_e_recibo @retificacao = TIPOS_DE_EVENTO_RETIFICAVEIS.include?(tipo_de_evento) && evento['ideEvento/indRetif'] == '2' @numero_do_recibo_a_retificar = evento['ideEvento/nrRecibo'] if retificacao? @momento_de_processamento_pelo_e_social = recibo['processamento/dhProcessamento'] end end |
#nome ⇒ Object
77 78 79 |
# File 'lib/teodoro/arquivo_xml.rb', line 77 def nome @nome ||= File.basename(caminho, '.xml') end |
#processar ⇒ Object
81 82 83 84 85 86 |
# File 'lib/teodoro/arquivo_xml.rb', line 81 def processar Console.print "processando #{nome}.xml..." do validar_versao_do_leiaute processar_arquivo end end |
#processavel? ⇒ Boolean
73 74 75 |
# File 'lib/teodoro/arquivo_xml.rb', line 73 def processavel? TIPOS_DE_EVENTO_PROCESSAVEIS.include?(tipo_de_evento) end |
#retificacao? ⇒ Boolean
69 70 71 |
# File 'lib/teodoro/arquivo_xml.rb', line 69 def retificacao? @retificacao end |