Class: Xampl::ResetIsChanged

Inherits:
Visitor
  • Object
show all
Defined in:
lib/xamplr/visitors.rb

Instance Attribute Summary

Attributes inherited from Visitor

#done, #no_children, #no_siblings

Instance Method Summary collapse

Methods inherited from Visitor

#after_visit, #around_visit, #cycle, #method_missing, #reset, #revisit, #short_circuit, #substitute_in_visit, #visit_string

Constructor Details

#initializeResetIsChanged

Returns a new instance of ResetIsChanged.



18
19
20
# File 'lib/xamplr/visitors.rb', line 18

def initialize
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Xampl::Visitor

Instance Method Details

#before_visit(xampl) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/xamplr/visitors.rb', line 33

def before_visit(xampl)
  if xampl.is_changed then
    puts "RESET CHANGED: #{xampl} and continue" if verbose
    xampl.is_changed = false;
  else
    puts "RESET CHANGED: #{xampl} block" if verbose
    @no_children = true
  end
end

#start(xampl, verbose = false) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/xamplr/visitors.rb', line 22

def start(xampl, verbose=false)
  @verbose = verbose
  if verbose
    puts "RESET IS CHANGED.... #{xampl}"
    puts "SKIPPING!!!" unless xampl.persist_required and xampl.load_needed
  end

  return if xampl.persist_required and xampl.load_needed
  super(xampl)
end