Class: FE::Document::OtherText

Inherits:
Element
  • Object
show all
Defined in:
lib/facturacr/document/other_text.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#document, #version

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ OtherText

Returns a new instance of OtherText.



8
9
10
11
# File 'lib/facturacr/document/other_text.rb', line 8

def initialize(args={})
  @xml_attributes = args[:xml_attributes] || {}
  @content = args[:content]
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/facturacr/document/other_text.rb', line 4

def content
  @content
end

#xml_attributesObject

Returns the value of attribute xml_attributes.



4
5
6
# File 'lib/facturacr/document/other_text.rb', line 4

def xml_attributes
  @xml_attributes
end

Instance Method Details

#build_xml(node, document) ⇒ Object

Raises:



13
14
15
16
17
18
19
20
# File 'lib/facturacr/document/other_text.rb', line 13

def build_xml(node, document)
  raise FE::Error.new("xml_attribues is not a hash",class: self.class) unless @xml_attributes.is_a?(Hash)
  
  node = Nokogiri::XML::Builder.new if node.nil?
  node.OtroTexto(@xml_attributes) do |xml|
    xml.text(@content)
  end
end