Method: WAX#text

Defined in:
lib/wax.rb

#text(obj, newline = false, escape = @check_me) ⇒ Object

Writes text inside the content of the current element.



536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/wax.rb', line 536

def text(obj, newline=false, escape=@check_me)
  if @check_me
    bad_state("text") if @state == :in_prolog or @state == :after_root
  end

  @has_content = true
  @has_indented_content = newline
  terminate_start

  text = obj.to_s if obj

  if obj != nil and text.length > 0
    write_indent if newline
    text = XMLUtil.escape(text) if escape
    out text
  elsif newline
    out "#{@cr}"
  end

  self
end