Sha256: 0f6ec27f6215afdebf18899a81be1941261cb284166e9cad17417624b63115be

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

module Nydp
  class Literal
    include Nydp::Helper
    attr_reader :expression

    def initialize expression
      @expression = expression
    end

    def self.build expression, bindings, ns
      new expression
    end

    def compile_to_ruby indent, srcs, opts=nil
      "#{indent}#{expression.compile_to_ruby "", srcs}"
    end

    def nydp_type ; :literal            ; end
    def inspect   ; @expression.inspect ; end
    def to_s      ; @expression.to_s    ; end
    def to_ruby   ; n2r @expression     ; end

    def > other
      other < expression
    end

    def < other
      other > expression
    end

    def == other
      other.is_a?(Literal) && (self.expression == other.expression)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nydp-0.6.0 lib/nydp/literal.rb