Class: HerbTr8nStringNode

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

Overview

This class is mostly responsible for all of the escaping that needs to occur for Tr8n to correctly understand the string.

Constant Summary collapse

ESCAPE_LOOKUP_TABLE =
[
 ["\"", "quot"],
 ["\n", "br"],
 ["–", "ndash"],
 ["—", "mdash"],
 ["¡", "iexcl"],
 ["¿", "iquest"],
 [""", "quot"],
 ["“", "ldquo"],
 ["”", "rdquo"],
 ["‘", "lsquo"],
 ["’", "rsquo"],
 ["«", "laquo"],
 ["»", "raquo"],
 [" ", "nbsp"]
]

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ HerbTr8nStringNode

Returns a new instance of HerbTr8nStringNode.



23
24
25
# File 'lib/nodes/herb_tr8n_string_node.rb', line 23

def initialize( string )
  @escaped_string = tr8n_escape( string )
end

Instance Method Details

#text_valueObject



27
28
29
# File 'lib/nodes/herb_tr8n_string_node.rb', line 27

def text_value
  @escaped_string
end

#to_sObject



31
32
33
# File 'lib/nodes/herb_tr8n_string_node.rb', line 31

def to_s
  text_value
end