Class: Minitest::Filesystem::Matcher::MatchingTree

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/filesystem/matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ MatchingTree

Returns a new instance of MatchingTree.



91
92
93
94
# File 'lib/minitest/filesystem/matcher.rb', line 91

def initialize(root)
  @root = Pathname.new(root)
  @tree = expand_tree_under @root
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



89
90
91
# File 'lib/minitest/filesystem/matcher.rb', line 89

def root
  @root
end

Instance Method Details

#expand_path(file) ⇒ Object



104
105
106
# File 'lib/minitest/filesystem/matcher.rb', line 104

def expand_path(file)
  @root + Pathname.new(file)
end

#include?(entry) ⇒ Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/minitest/filesystem/matcher.rb', line 96

def include?(entry)
  @tree.include?(expand_path(entry))
end

#is_a?(entry, kind) ⇒ Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/minitest/filesystem/matcher.rb', line 100

def is_a?(entry, kind)
  (expand_path entry).send("#{kind}?")
end