Class: SunatInvoice::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/sunat_invoice/model.rb

Direct Known Subclasses

Line, Signature, Tax, Tributer, XmlDocument

Instance Method Summary collapse

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(options = {})
  options.each do |key, value|
    send("#{key}=", value) if respond_to?("#{key}=")
  end
end

Instance Method Details

#to_hashObject



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