class PDFRavager::Fields::RichText

Attributes

name[R]
value[R]

Public Class Methods

new(name, value) click to toggle source
# File lib/pdf_ravager/fields/rich_text.rb, line 10
def initialize(name, value)
  @name, @value = name, value
end

Public Instance Methods

==(other) click to toggle source
# File lib/pdf_ravager/fields/rich_text.rb, line 14
def ==(other)
  self.name == other.name && self.value == other.value
end
set_xfa_value(node) click to toggle source
# File lib/pdf_ravager/fields/rich_text.rb, line 18
def set_xfa_value(node)
  value_node = node.at_xpath("*[local-name()='value']")
  value_node && value_node.remove # we will replace the whole <value> node
  Nokogiri::XML::Builder.with(node) do |xml|
    xml.value_ {
      xml.exData('contentType' => 'text/html') {
        xml.body_('xmlns'     => "http://www.w3.org/1999/xhtml",
                  'xmlns:xfa' => "http://www.xfa.org/schema/xfa-data/1.0/") {
          xml << xfa_value
        }
      }
    }
  end
end