Module: NfeReader::AttributeHelper
- Included in:
- Address, Armament, Authorization, Billing, Cane, Carrier, Cofins, CofinsSt, Customer, Delivery, Document, Duplicate, Export, Exportation, Fiscal, Fuel, Header, Icms, Importation, ImportationTax, Information, Ipi, Issqn, Medicament, Nfe, Person, Pis, PisSt, Product, Purchase, Removal, Total, Transport, Vehicle
- Defined in:
- lib/nfe_reader/helpers/attribute_helper.rb
Constant Summary collapse
- WITHELIST =
%w(taxpayer_messages messages seals)
Instance Method Summary collapse
Instance Method Details
#attributes ⇒ Object
3 4 5 |
# File 'lib/nfe_reader/helpers/attribute_helper.rb', line 3 def attributes @attributes ||= attributes_to_hash end |
#attributes_to_hash ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nfe_reader/helpers/attribute_helper.rb', line 9 def attributes_to_hash attrs = Hash.new instance_variables.each do |var| key = var.to_s.gsub /^@/, '' value = instance_variable_get(var) if [String, Hash].include?(value.class) || WITHELIST.include?(key) attrs[key] = value end end attrs end |