Last active
September 18, 2019 12:41
-
-
Save brunoandradd/acb35ba34a325c87035e2faf810a0cae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Código atual: | |
if item.try(:percentual_via) | |
if item.try(:percentual_via).present? | |
codigo_via = Convenio::PercentualVia.codigo_da_via(item.percentual_via.tipo) | |
xml.viaAcesso codigo_via | |
else | |
xml.viaAcesso '1' | |
end | |
else | |
xml.viaAcesso '1' | |
end | |
#Refactory: | |
xml.viaAcesso Convenio::PercentualVia.codigo_da_via(item.percentual_via.tipo) | |
#Em Convenio::PercentualVia | |
VIA_PADRAO = VIAS_CODIGOS[:unica] | |
def self.codigo_da_via(via=nil) | |
if via | |
VIAS_CODIGOS[via] | |
else | |
VIA_PADRAO | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment