Class: BrNfe::ActiveModelBase
- Inherits:
-
Object
- Object
- BrNfe::ActiveModelBase
- Includes:
- ActiveModel::Model
- Defined in:
- lib/br_nfe/active_model_base.rb
Direct Known Subclasses
Base, CondicaoPagamento, Destinatario, Emitente, Endereco, Servico::Betha::BuildResponse, Servico::Intermediario, Servico::Response::Default, Servico::Response::NotaFiscal, Servico::Rps
Instance Method Summary collapse
- #assign_attributes(attributes) ⇒ Object
- #default_values ⇒ Object
-
#initialize(attributes = {}) {|_self| ... } ⇒ ActiveModelBase
constructor
A new instance of ActiveModelBase.
Constructor Details
#initialize(attributes = {}) {|_self| ... } ⇒ ActiveModelBase
Returns a new instance of ActiveModelBase.
5 6 7 8 9 |
# File 'lib/br_nfe/active_model_base.rb', line 5 def initialize(attributes = {}) attributes = default_values.merge!(attributes) assign_attributes(attributes) yield self if block_given? end |
Instance Method Details
#assign_attributes(attributes) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/br_nfe/active_model_base.rb', line 11 def assign_attributes(attributes) attributes ||= {} attributes.each do |name, value| send("#{name}=", value) end end |
#default_values ⇒ Object
18 19 20 |
# File 'lib/br_nfe/active_model_base.rb', line 18 def default_values {} end |