class Minitest::Filesystem::Matcher::MatchingTree
Attributes
root[R]
Public Class Methods
new(root)
click to toggle source
# File lib/minitest/filesystem/matcher.rb, line 97 def initialize(root) @root = Pathname.new(root) @tree = expand_tree_under @root end
Public Instance Methods
expand_path(file)
click to toggle source
# File lib/minitest/filesystem/matcher.rb, line 114 def expand_path(file) @root + Pathname.new(file) end
follow_link(link)
click to toggle source
# File lib/minitest/filesystem/matcher.rb, line 118 def follow_link(link) Pathname.new(File.readlink(expand_path(link))) end
has_target?(entry, target)
click to toggle source
# File lib/minitest/filesystem/matcher.rb, line 110 def has_target?(entry, target) expand_path(target) == follow_link(entry) end
include?(entry)
click to toggle source
# File lib/minitest/filesystem/matcher.rb, line 102 def include?(entry) @tree.include?(expand_path(entry)) end
is_a?(entry, kind)
click to toggle source
# File lib/minitest/filesystem/matcher.rb, line 106 def is_a?(entry, kind) (expand_path entry).send("#{kind}?") end
Private Instance Methods
expand_tree_under(dir)
click to toggle source
# File lib/minitest/filesystem/matcher.rb, line 124 def expand_tree_under(dir) Pathname.glob(dir.join("**/*")) end