Class: UClassifyText

Inherits:
Object
  • Object
show all
Defined in:
lib/uclassify_text.rb

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ UClassifyText

Returns a new instance of UClassifyText.



3
4
5
# File 'lib/uclassify_text.rb', line 3

def initialize(text)
  @text = text
end

Instance Method Details

#to_xml_node(xml_document) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/uclassify_text.rb', line 7

def to_xml_node xml_document
  text_base64_node = Nokogiri::XML::Node.new('textBase64',xml_document)
  text_base64_node['id'] = UClassifyUtils.string_to_id(@text)
  encoded_string = Base64.encode64(@text)   
  
  frag = text_base64_node.parse(encoded_string.strip)
  text_base64_node.add_child(frag)
  text_base64_node   
end