Macthes the scope `s` matches `s2`.
(blk nlp.Block)
| 47 | |
| 48 | // Macthes the scope `s` matches `s2`. |
| 49 | func (s Scope) Matches(blk nlp.Block) bool { |
| 50 | candidate := NewSelector(strings.Split(blk.Scope, ".")) |
| 51 | parent := NewSelector(strings.Split(blk.Parent, ".")) |
| 52 | |
| 53 | for _, sel := range s.Selectors { |
| 54 | if s.partMatches(candidate, parent, sel) { |
| 55 | return true |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | return false |
| 60 | } |
| 61 | |
| 62 | func (s Scope) partMatches(target, parent Selector, options []Selector) bool { |
| 63 | for _, part := range options { |
no test coverage detected