lib/moxml/comment.rb in moxml-0.1.0 vs lib/moxml/comment.rb in moxml-0.1.1
- old
+ new
@@ -1,35 +1,19 @@
+# frozen_string_literal: true
+
module Moxml
class Comment < Node
- def initialize(content_or_native = nil)
- case content_or_native
- when String
- super(adapter.create_comment(nil, content_or_native))
- else
- super(content_or_native)
- end
- end
-
def content
- adapter.comment_content(native)
+ adapter.comment_content(@native)
end
def content=(text)
- adapter.set_comment_content(native, text)
- self
+ text = normalize_xml_value(text)
+ adapter.validate_comment_content(text)
+ adapter.set_comment_content(@native, text)
end
- def blank?
- content.strip.empty?
- end
-
def comment?
true
- end
-
- private
-
- def create_native_node
- adapter.create_comment(nil, "")
end
end
end