Class: SunatInvoice::Model
- Inherits:
-
Object
- Object
- SunatInvoice::Model
- Defined in:
- lib/sunat_invoice/model.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Model
constructor
A new instance of Model.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Model
Returns a new instance of Model.
5 6 7 8 9 |
# File 'lib/sunat_invoice/model.rb', line 5 def initialize( = {}) .each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end |
Instance Method Details
#to_hash ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/sunat_invoice/model.rb', line 11 def to_hash hash = {} instance_variables.map do |var| var_name = var.to_s.split('@')[1] hash[var_name] = instance_variable_get(var) end hash end |