Sha256: 4a0a428cb3428eef382c473d285e9e0e2769d2063d3b2760ba0b29c86549735a

Contents?: true

Size: 366 Bytes

Versions: 3

Compression:

Stored size: 366 Bytes

Contents

# frozen_string_literal: true

module Preval
  class Visitor
    def process(source)
      sexp = Parser.parse(source)
      sexp.tap { |node| node.visit(self) }.to_source if sexp
    end

    def process!(source)
      process(source).tap { |response| raise SyntaxError unless response }
    end

    def self.enable!
      Preval.visitors << new
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
preval-0.3.0 lib/preval/visitor.rb
preval-0.2.0 lib/preval/visitor.rb
preval-0.1.0 lib/preval/visitor.rb