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.



1108
1109
1110
# File 'lib/rexle.rb', line 1108

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

Instance Method Details

#cloneObject



1112
1113
1114
# File 'lib/rexle.rb', line 1112

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

#inspectObject



1116
1117
1118
# File 'lib/rexle.rb', line 1116

def inspect()
  @value.inspect
end


1120
1121
1122
# File 'lib/rexle.rb', line 1120

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

#to_sObject



1124
1125
1126
# File 'lib/rexle.rb', line 1124

def to_s()
  @value
end

#unescapeObject



1128
1129
1130
1131
1132
# File 'lib/rexle.rb', line 1128

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