class Evertils::Common::ENMLElement

Public Class Methods

new(colour) click to toggle source

@since 0.3.3

# 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

Public Instance Methods

body=(content) click to toggle source

@since 0.3.3

# 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() click to toggle source

Required as part of the thrift data conversion @since 0.3.3

# File lib/evertils/common/enmlelement.rb, line 30
def encoding
  Encoding::UTF_8
end
force_encoding(enc) click to toggle source

Required as part of the thrift data conversion @since 0.3.3

# File lib/evertils/common/enmlelement.rb, line 36
def force_encoding(enc)
  @enml.to_s.encode(enc)
end
to_s() click to toggle source

@since 0.3.3

# File lib/evertils/common/enmlelement.rb, line 24
def to_s
  @enml.to_s.encode(Encoding::UTF_8)
end