Sha256: 173dc8fd00b07f9cac9945f42c40d59246d300544ec82efa96338d4205ebdc11

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

module Moxml
  class Text < Node
    def initialize(content_or_native = nil)
      case content_or_native
      when String
        super(adapter.create_text(nil, content_or_native))
      else
        super(content_or_native)
      end
    end

    def content
      adapter.text_content(native)
    end

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

    def blank?
      content.strip.empty?
    end

    def cdata?
      false
    end

    def text?
      true
    end

    private

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

Version data entries

1 entries across 1 versions & 1 rubygems

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