Class: Evertils::Common::ENMLElement
- Inherits:
-
Object
- Object
- Evertils::Common::ENMLElement
- Defined in:
- lib/evertils/common/enmlelement.rb
Overview
Instance Method Summary collapse
- #body=(content) ⇒ Object
-
#encoding ⇒ Object
Required as part of the thrift data conversion.
-
#force_encoding(enc) ⇒ Object
Required as part of the thrift data conversion.
-
#initialize(colour) ⇒ ENMLElement
constructor
A new instance of ENMLElement.
- #to_s ⇒ Object
Constructor Details
#initialize(colour) ⇒ ENMLElement
Returns a new instance of ENMLElement.
6 7 8 9 10 |
# File 'lib/evertils/common/enmlelement.rb', line 6 def initialize(colour) @colour = colour @enml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" @enml += "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">" end |
Instance Method Details
#body=(content) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/evertils/common/enmlelement.rb', line 14 def body=(content) # at some point between 10/30/2017 and 11/06/2017, adding bgcolor to # the root element started throwing EDAM code 11 # (Content is not allowed in prolog). Commenting out for now. # @enml += "<en-note bgcolor=\"##{@colour.to_s(16)}\">#{content}</en-note>" @enml += "<en-note>#{content}</en-note>" end |
#encoding ⇒ Object
Required as part of the thrift data conversion
30 31 32 |
# File 'lib/evertils/common/enmlelement.rb', line 30 def encoding Encoding::UTF_8 end |
#force_encoding(enc) ⇒ Object
Required as part of the thrift data conversion
36 37 38 |
# File 'lib/evertils/common/enmlelement.rb', line 36 def force_encoding(enc) @enml.to_s.encode(enc) end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/evertils/common/enmlelement.rb', line 24 def to_s @enml.to_s.encode(Encoding::UTF_8) end |