Method: RBS::Annotate::Annotations#test_path

Defined in:
lib/rbs/annotate/annotations.rb

#test_path(path) ⇒ Object



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/rbs/annotate/annotations.rb', line 164

def test_path(path)
  # @type var source_items: Array[Source]
  source_items = _ = items.select {|item| item.is_a?(Source) }

  return true if source_items.empty?

  result = source_items[0].include_source == nil

  items.each do |a|
    if a.is_a?(Source)
      if pat = a.include_source
        if test_path_string(pat, path)
          result = true
        end
      end

      if pat = a.skip_source
        if test_path_string(pat, path)
          result = false
        end
      end
    end
  end

  result
end