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.



1252
1253
1254
# File 'lib/rexle.rb', line 1252

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

Instance Method Details

#cloneObject



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

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

#inspectObject



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

def inspect()
  @value.inspect
end


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

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

#to_sObject



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

def to_s()
  @value
end

#unescapeObject



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

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