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.



41
42
43
# File 'lib/xamplr/visitors.rb', line 41

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



56
57
58
59
60
61
62
63
64
# File 'lib/xamplr/visitors.rb', line 56

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



45
46
47
48
49
50
51
52
53
54
# File 'lib/xamplr/visitors.rb', line 45

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