Class: MCFDI::Base
- Inherits:
-
Object
- Object
- MCFDI::Base
- Defined in:
- lib/m_cfdi/base.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#attributes ⇒ Object
return list of attr_accessors.
-
#to_h ⇒ Object
return hash of attributes with values.
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 |
.attributes ⇒ Object
9 10 11 |
# File 'lib/m_cfdi/base.rb', line 9 def self.attributes @attributes end |
Instance Method Details
#attributes ⇒ Object
return list of attr_accessors.
14 15 16 |
# File 'lib/m_cfdi/base.rb', line 14 def attributes self.class.attributes end |
#to_h ⇒ Object
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 |