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.



1256
1257
1258
# File 'lib/rexle.rb', line 1256

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

Instance Method Details

#cloneObject



1260
1261
1262
# File 'lib/rexle.rb', line 1260

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

#inspectObject



1264
1265
1266
# File 'lib/rexle.rb', line 1264

def inspect()
  @value.inspect
end


1268
1269
1270
# File 'lib/rexle.rb', line 1268

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

#to_sObject



1272
1273
1274
# File 'lib/rexle.rb', line 1272

def to_s()
  @value
end

#unescapeObject



1276
1277
1278
1279
1280
# File 'lib/rexle.rb', line 1276

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