Sha256: 85b1fbc1eb62b70cf0861eb65d45a8e6299da599a900211f5a3bb5724df726f0

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

module PageEz
  class PageVisitor
    def initialize
      @visitors = [
        Visitors::DebugVisitor.new,
        Visitors::RegisteredNameVisitor.new,
        Visitors::MacroPluralizationVisitor.new,
        Visitors::MatcherCollisionVisitor.new
      ]
    end

    def begin_block_evaluation
      @visitors.each do |visitor|
        visitor.begin_block_evaluation
      end
    end

    def end_block_evaluation
      @visitors.each do |visitor|
        visitor.end_block_evaluation
      end
    end

    def define_method(name)
      @visitors.each do |visitor|
        visitor.define_method(name)
      end
    end

    def inherit_from(subclass)
      @visitors.each do |visitor|
        visitor.inherit_from(subclass)
      end
    end

    def track_method_added(name, construction_strategy)
      @visitors.each do |visitor|
        visitor.track_method_added(name, construction_strategy)
      end
    end

    def track_method_undefined(name)
      @visitors.each do |visitor|
        visitor.track_method_undefined(name)
      end
    end

    def track_method_renamed(from, to)
      @visitors.each do |visitor|
        visitor.track_method_renamed(from, to)
      end
    end

    def track_method_delegated(name)
      @visitors.each do |visitor|
        visitor.track_method_delegated(name)
      end
    end

    def process_macro(macro, name, construction_strategy)
      @visitors.each do |visitor|
        visitor.process_macro(macro, name, construction_strategy)
      end
    end

    def reset
      @visitors.each do |visitor|
        visitor.reset
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page_ez-0.2.0 lib/page_ez/page_visitor.rb
page_ez-0.1.0 lib/page_ez/page_visitor.rb