Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
otavioschwanck committed Sep 26, 2018
1 parent 3c38dca commit ff5e67b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/br_invoices_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ module BrInvoicesPdf
def generate(type, xml, options = {})
generator = @generators[type]
raise(Errors::InvalidDocumentType, type) unless generator

generator.generate(xml, options)
end

def register(type, renderer, parser)
raise(ArgumentError, "Expected Symbol or String to type. Received #{type.class}") unless valid_type?(type)

@generators[type.to_sym] = Generator.new(renderer, parser)
end

Expand Down
2 changes: 2 additions & 0 deletions lib/br_invoices_pdf/cfe/parser/access_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ module AccessKey
def execute(xml)
element = xml.locate('Signature/SignedInfo').first
return unless element

element = element.nodes.last
return unless element

element.attributes[:URI]
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/br_invoices_pdf/cfe/parser/fisco_obs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def execute(xml)
node = element.nodes.first
field = element.attributes[:xCampo]
next unless node && field

{
text: node.text,
field: field
Expand Down
1 change: 1 addition & 0 deletions lib/br_invoices_pdf/cfe/parser/payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def execute(xml)
node_payments = xml.locate('infCFe/pgto')

return unless node_payments

payments_by_nodes(node_payments) if node_payments.any?
end

Expand Down
4 changes: 2 additions & 2 deletions lib/br_invoices_pdf/nfce/parser/payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module Payments
module_function

def execute(xml)
xml_version = xml.locate("#{root_path(xml)}")[0].attributes[:versao]
xml_version = xml.locate(root_path(xml).to_s)[0].attributes[:versao]

return payments_new_version(xml) if xml_version[0] == "4"
return payments_new_version(xml) if xml_version[0] == '4'

payments_old_version(xml)
end
Expand Down
1 change: 1 addition & 0 deletions lib/br_invoices_pdf/nfce/renderer/procon_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def execute(pdf, data)
procon_message = data[:additional_variables][:procon_message]

return if ['', nil].include? procon_message

box(pdf, [0, pdf.cursor], page_content_width(pdf)) do
procon_message(pdf, procon_message)
end
Expand Down

0 comments on commit ff5e67b

Please sign in to comment.