Class: Rexle::CData

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

Instance Method Summary collapse

Constructor Details

#initialize(val = '') ⇒ CData

Returns a new instance of CData.



1209
1210
1211
# File 'lib/rexle.rb', line 1209

def initialize(val='')
  @value = val
end

Instance Method Details

#cloneObject



1213
1214
1215
# File 'lib/rexle.rb', line 1213

def clone()
  CData.new(@value)
end

#inspectObject



1217
1218
1219
# File 'lib/rexle.rb', line 1217

def inspect()
  @value.inspect
end


1221
1222
1223
# File 'lib/rexle.rb', line 1221

def print()
  "<![CDATA[%s]]>" % @value
end

#to_sObject



1225
1226
1227
# File 'lib/rexle.rb', line 1225

def to_s()
  @value
end

#unescapeObject



1229
1230
1231
1232
1233
# File 'lib/rexle.rb', line 1229

def unescape()
  s = @value.clone
  %w(&lt; < &gt; > &amp; & &pos; ').each_slice(2){|x| s.gsub!(*x)}
  s
end