class PnoteClient::Documents::Hml::Char

Attributes

text[R]

Public Class Methods

from_tag(char_tag) click to toggle source

Textable Element

# File lib/pnote_client/documents/hml/char.rb, line 7
def self.from_tag(char_tag)
  char = self.new

  char_tag.children.each do |child|
    if child.name == 'LINEBREAK'
      char.add_text("\n")
    elsif child.name == 'TAB'
      char.add_text("\t")
    else
      char.add_text(child.content)
    end
  end

  return char
end
new(text = '') click to toggle source
# File lib/pnote_client/documents/hml/char.rb, line 25
def initialize(text = '')
  @text = text
end

Public Instance Methods

add_text(text) click to toggle source
# File lib/pnote_client/documents/hml/char.rb, line 29
def add_text(text)
  @text += text
end
content() click to toggle source
# File lib/pnote_client/documents/hml/char.rb, line 33
def content
  # 일반 텍스트는 변환작업을 하지 않지만
  # 닮음기호는 예외 상황으로 처리
  @text.gsub(/\xf3\xb0\x81\x80/, "$\\backsim$")
end
textable?() click to toggle source
# File lib/pnote_client/documents/hml/char.rb, line 39
def textable?
  return true
end