Class Amrita::TextElement
In: lib/amrita/format.rb
lib/amrita/node.rb
Parent: Object

immutable object

Methods

==   clone   format   new   to_ruby   to_s  

Included Modules

Node

Public Class methods

[Source]

# File lib/amrita/node.rb, line 569
    def initialize(text=nil)
      case text
      when nil
        @text = ""
      when String
        @text = text.frozen_copy
      when TextElement
        @text = x.to_s
      else
        @text = value.to_s.freeze 
      end
    end

Public Instance methods

[Source]

# File lib/amrita/node.rb, line 586
    def ==(x)
      if x.is_a?(String)
        return @text == x
      else
        return @text == x.to_s
      end
    end

[Source]

# File lib/amrita/node.rb, line 582
    def clone
      self # immutable object can be shared always
    end

[Source]

# File lib/amrita/format.rb, line 568
    def format(f)
      f.format_text(@text)
    end

[Source]

# File lib/amrita/node.rb, line 594
    def to_ruby
      @text.inspect
    end

[Source]

# File lib/amrita/node.rb, line 598
    def to_s
      @text
    end

[Validate]