lib/moxml/cdata.rb in moxml-0.1.0 vs lib/moxml/cdata.rb in moxml-0.1.1
- old
+ new
@@ -1,39 +1,17 @@
+# frozen_string_literal: true
+
module Moxml
class Cdata < Node
- def initialize(content_or_native = nil)
- case content_or_native
- when String
- super(adapter.create_cdata(nil, content_or_native))
- else
- super(content_or_native)
- end
- end
-
def content
- adapter.cdata_content(native)
+ adapter.cdata_content(@native)
end
def content=(text)
- adapter.set_cdata_content(native, text)
- self
+ adapter.set_cdata_content(@native, normalize_xml_value(text))
end
- def blank?
- content.strip.empty?
- end
-
def cdata?
true
- end
-
- def text?
- false
- end
-
- private
-
- def create_native_node
- adapter.create_cdata(nil, "")
end
end
end