Class: ATP::Validator

Inherits:
Processor show all
Defined in:
lib/atp/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Processor

#handler_missing, #n, #n0, #n1, #run

Constructor Details

#initialize(flow) ⇒ Validator

Returns a new instance of Validator.



6
7
8
# File 'lib/atp/validator.rb', line 6

def initialize(flow)
  @flow = flow
end

Instance Attribute Details

#flowObject (readonly)

Returns the value of attribute flow.



4
5
6
# File 'lib/atp/validator.rb', line 4

def flow
  @flow
end

Instance Method Details

#process(node) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/atp/validator.rb', line 10

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

#setupObject



31
32
# File 'lib/atp/validator.rb', line 31

def setup
end

#test_process(node) ⇒ Object

For test purposes, returns true if validation failed rather than exiting the process



25
26
27
28
29
# File 'lib/atp/validator.rb', line 25

def test_process(node)
  @testing = true
  process(node)
  on_completion
end