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.



1207
1208
1209
# File 'lib/rexle.rb', line 1207

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

Instance Method Details

#cloneObject



1211
1212
1213
# File 'lib/rexle.rb', line 1211

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

#inspectObject



1215
1216
1217
# File 'lib/rexle.rb', line 1215

def inspect()
  @value.inspect
end


1219
1220
1221
# File 'lib/rexle.rb', line 1219

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

#to_sObject



1223
1224
1225
# File 'lib/rexle.rb', line 1223

def to_s()
  @value
end

#unescapeObject



1227
1228
1229
1230
1231
# File 'lib/rexle.rb', line 1227

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