Sha256: 84ebc677e74fb5de8da3b68ea1449396f22471da7ba00ac64d569f8bee06b95e

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

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)
    end

    def content=(text)
      adapter.set_comment_content(native, text)
      self
    end

    def blank?
      content.strip.empty?
    end

    def comment?
      true
    end

    private

    def create_native_node
      adapter.create_comment(nil, "")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moxml-0.1.0 lib/moxml/comment.rb