module Nfe::Helpers::XmlModel::NfeModel::ClassMethods

Public Instance Methods

attr_xml(xml_attr, options={}) click to toggle source
# File lib/nfe/helpers/xml_model/nfe_model.rb, line 10
def attr_xml(xml_attr, options={})
  register_xml_attr xml_attr, options
  register_attr_acessor xml_attribute(xml_attr)
end
xml_attribute(attribute) click to toggle source
# File lib/nfe/helpers/xml_model/nfe_model.rb, line 23
def xml_attribute(attribute)
  xml_attributes[attribute]
end
xml_attributes() click to toggle source
# File lib/nfe/helpers/xml_model/nfe_model.rb, line 15
def xml_attributes
  @xml_attributes ||= {}
  if self.superclass.methods.include?(:xml_attributes)
    @xml_attributes = self.superclass.xml_attributes.merge @xml_attributes
  end
  @xml_attributes
end

Private Instance Methods

register_attr_acessor(xml_attr) click to toggle source
# File lib/nfe/helpers/xml_model/nfe_model.rb, line 32
def register_attr_acessor(xml_attr)
  instance_eval do
    attr_accessor xml_attr.name unless xml_attr.type.equal? :enumerize
  end
end
register_xml_attr(xml_attr, options) click to toggle source
# File lib/nfe/helpers/xml_model/nfe_model.rb, line 28
def register_xml_attr(xml_attr, options)
  xml_attributes[xml_attr] = Factory.create xml_attr, options
end