Class: RBelly::Visitors::PointcutVisitor
- Defined in:
- lib/rbelly/visitors/pointcut_visitor.rb
Constant Summary
Constants inherited from Visitor
Visitor::ALL_NODES, Visitor::ARRAY_VALUE_NODES, Visitor::BELLEJS_FUNC_NODES, Visitor::BELLEJS_VAR_NODES, Visitor::BINARY_NODES, Visitor::CLASS_NODES, Visitor::CONDITIONAL_NODES, Visitor::FUNC_CALL_NODES, Visitor::FUNC_DECL_NODES, Visitor::NAME_VALUE_NODES, Visitor::PREFIX_POSTFIX_NODES, Visitor::SINGLE_VALUE_NODES, Visitor::TERMINAL_NODES
Instance Attribute Summary collapse
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
Instance Method Summary collapse
- #>(pattern) ⇒ Object
-
#initialize(pattern, matches = []) ⇒ PointcutVisitor
constructor
A new instance of PointcutVisitor.
Methods inherited from Visitor
#accept, #visit_BracketAccessorNode, #visit_DotAccessorNode, #visit_ForInNode, #visit_ForNode, #visit_TryNode
Constructor Details
#initialize(pattern, matches = []) ⇒ PointcutVisitor
Returns a new instance of PointcutVisitor.
5 6 7 8 |
# File 'lib/rbelly/visitors/pointcut_visitor.rb', line 5 def initialize(pattern, matches = []) @pattern = pattern @matches = matches end |
Instance Attribute Details
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
4 5 6 |
# File 'lib/rbelly/visitors/pointcut_visitor.rb', line 4 def matches @matches end |
Instance Method Details
#>(pattern) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rbelly/visitors/pointcut_visitor.rb', line 10 def >(pattern) pattern = case pattern when Class pattern.new(Object) else pattern end self.class.new(nil, @matches.map do |m| m.pointcut(pattern).matches end.flatten) end |