Sha256: 46dddea21a6bb2495a4cfa174e7dbba1e42b41ab33824b7542c84591ae0a93f7

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

module CoffeeScript

  # Instead of producing raw Ruby objects, the Lexer produces values of this
  # class, wrapping native objects tagged with line number information.
  class Value
    attr_reader :value, :line

    def initialize(value, line=nil)
      @value, @line = value, line
    end

    def to_str
      @value.to_s
    end
    alias_method :to_s, :to_str

    def to_sym
      to_str.to_sym
    end

    def inspect
      @value.inspect
    end

    def ==(other)
      @value == other
    end

    def [](index)
      @value[index]
    end

    def eql?(other)
      @value.eql?(other)
    end

    def hash
      @value.hash
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coffee-script-0.2.2 lib/coffee_script/value.rb