Class: MCFDI::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/m_cfdi/base.rb

Direct Known Subclasses

Addenda, Address, Complement, Concept, Entity, Invoice, Taxes

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attr_accessor(*vars) ⇒ Object



3
4
5
6
7
# File 'lib/m_cfdi/base.rb', line 3

def self.attr_accessor(*vars)
  @attributes ||= []
  @attributes.concat vars
  super(*vars)
end

.attributesObject



9
10
11
# File 'lib/m_cfdi/base.rb', line 9

def self.attributes
  @attributes
end

Instance Method Details

#attributesObject

return list of attr_accessors.



14
15
16
# File 'lib/m_cfdi/base.rb', line 14

def attributes
  self.class.attributes
end

#to_hObject

return hash of attributes with values.



19
20
21
22
23
# File 'lib/m_cfdi/base.rb', line 19

def to_h
  h = {}
  attributes.each { |k| h[k] = send(k) }
  h
end