Class: PDFRavager::Fields::RichText
- Inherits:
-
Object
- Object
- PDFRavager::Fields::RichText
- Includes:
- PDFRavager::FieldTypes::XFA
- Defined in:
- lib/pdf_ravager/fields/rich_text.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, value) ⇒ RichText
constructor
A new instance of RichText.
- #set_xfa_value(node) ⇒ Object
Methods included from PDFRavager::FieldTypes::XFA
#xfa_name, #xfa_node_type, #xfa_value
Constructor Details
#initialize(name, value) ⇒ RichText
Returns a new instance of RichText.
10 11 12 |
# File 'lib/pdf_ravager/fields/rich_text.rb', line 10 def initialize(name, value) @name, @value = name, value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/pdf_ravager/fields/rich_text.rb', line 8 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/pdf_ravager/fields/rich_text.rb', line 8 def value @value end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 |
# 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) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |