Class: Resedit::TableEscaper
Constant Summary
Constants inherited
from TextEscaper
Resedit::TextEscaper::STD_TABLE
Instance Method Summary
collapse
Methods inherited from TextEscaper
#escape
Constructor Details
#initialize(table = nil, stdTable = STD_TABLE) ⇒ TableEscaper
Returns a new instance of TableEscaper.
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/resedit/text/escaper.rb', line 89
def initialize(table=nil, stdTable=STD_TABLE)
@table={}
if stdTable
stdTable.each {|b, e|
add(b, e)
}
end
if table
table.each {|b, e|
add(b,e)
}
end
end
|
Instance Method Details
#_escape(b) ⇒ Object
107
108
109
|
# File 'lib/resedit/text/escaper.rb', line 107
def _escape(b)
@table[b] ? @table[b] : b.chr
end
|
#add(byte, esc) ⇒ Object
103
104
105
|
# File 'lib/resedit/text/escaper.rb', line 103
def add(byte, esc)
@table[byte] = esc
end
|
#unescape(line) ⇒ Object
111
112
113
|
# File 'lib/resedit/text/escaper.rb', line 111
def unescape(line)
tableReplace(line,@table,false)
end
|