Class: PageEz::Visitors::MatcherCollisionVisitor
- Inherits:
-
Object
- Object
- PageEz::Visitors::MatcherCollisionVisitor
- Defined in:
- lib/page_ez/visitors/matcher_collision_visitor.rb
Instance Method Summary collapse
- #begin_block_evaluation ⇒ Object
- #define_method(name) ⇒ Object
- #end_block_evaluation ⇒ Object
- #inherit_from(subclass) ⇒ Object
-
#initialize ⇒ MatcherCollisionVisitor
constructor
A new instance of MatcherCollisionVisitor.
- #process_macro(macro, name, construction_strategy) ⇒ Object
- #reset ⇒ Object
- #track_method_added(name, construction_strategy) ⇒ Object
- #track_method_delegated(name) ⇒ Object
- #track_method_renamed(from, to) ⇒ Object
- #track_method_undefined(name) ⇒ Object
Constructor Details
#initialize ⇒ MatcherCollisionVisitor
Returns a new instance of MatcherCollisionVisitor.
4 5 6 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 4 def initialize reset end |
Instance Method Details
#begin_block_evaluation ⇒ Object
8 9 10 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 8 def begin_block_evaluation @depth_visitor.begin_block_evaluation end |
#define_method(name) ⇒ Object
16 17 18 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 16 def define_method(name) @depth_visitor.define_method(name) end |
#end_block_evaluation ⇒ Object
12 13 14 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 12 def end_block_evaluation @depth_visitor.end_block_evaluation end |
#inherit_from(subclass) ⇒ Object
20 21 22 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 20 def inherit_from(subclass) @depth_visitor.inherit_from(subclass) end |
#process_macro(macro, name, construction_strategy) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 40 def process_macro(macro, name, construction_strategy) @depth_visitor.process_macro(macro, name, construction_strategy) if existing_matchers.include?(name.to_s) rendered_macro = "#{macro} :#{name}, \"#{construction_strategy.selector}\"" whitespace = " " * @depth_visitor.depth = "#{whitespace}#{rendered_macro} will conflict with Capybara's `have_#{name}` matcher" case PageEz.configuration.on_matcher_collision when :warn PageEz.configuration.logger.warn() when :raise raise MatcherCollisionError, end end end |
#reset ⇒ Object
56 57 58 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 56 def reset @depth_visitor = DepthVisitor.new end |
#track_method_added(name, construction_strategy) ⇒ Object
24 25 26 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 24 def track_method_added(name, construction_strategy) @depth_visitor.track_method_added(name, construction_strategy) end |
#track_method_delegated(name) ⇒ Object
36 37 38 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 36 def track_method_delegated(name) @depth_visitor.track_method_delegated(name) end |
#track_method_renamed(from, to) ⇒ Object
32 33 34 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 32 def track_method_renamed(from, to) @depth_visitor.track_method_renamed(from, to) end |
#track_method_undefined(name) ⇒ Object
28 29 30 |
# File 'lib/page_ez/visitors/matcher_collision_visitor.rb', line 28 def track_method_undefined(name) @depth_visitor.track_method_undefined(name) end |