Sha256: b1d1ff30a30bf661bbbb0de6c59a688d59d303db98bbf5f308bf1f419ff265bd

Contents?: true

Size: 588 Bytes

Versions: 14

Compression:

Stored size: 588 Bytes

Contents

require 'ast'
module ATP
  class Validator < Processor
    attr_reader :flow

    def initialize(flow)
      @flow = flow
    end

    def process(node)
      if @top_level_called
        super
      else
        @top_level_called = true
        setup
        super(node)
        unless @testing
          exit 1 if on_completion
        end
      end
    end

    # For test purposes, returns true if validation failed rather
    # than exiting the process
    def test_process(node)
      @testing = true
      process(node)
      on_completion
    end

    def setup
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
atp-0.8.0 lib/atp/validator.rb
atp-0.7.0 lib/atp/validator.rb
atp-0.6.0 lib/atp/validator.rb
atp-0.5.4 lib/atp/validator.rb
atp-0.5.3 lib/atp/validator.rb
atp-0.5.0 lib/atp/validator.rb
atp-0.4.3 lib/atp/validator.rb
atp-0.4.2 lib/atp/validator.rb
atp-0.4.1 lib/atp/validator.rb
atp-0.4.0 lib/atp/validator.rb
atp-0.3.3 lib/atp/validator.rb
atp-0.3.2 lib/atp/validator.rb
atp-0.3.1 lib/atp/validator.rb
atp-0.3.0 lib/atp/validator.rb