Class: Minitest::Filesystem::Matcher::MatchingTree
- Inherits:
-
Object
- Object
- Minitest::Filesystem::Matcher::MatchingTree
- Defined in:
- lib/minitest/filesystem/matcher.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #expand_path(file) ⇒ Object
- #follow_link(link) ⇒ Object
- #has_target?(entry, target) ⇒ Boolean
- #include?(entry) ⇒ Boolean
-
#initialize(root) ⇒ MatchingTree
constructor
A new instance of MatchingTree.
- #is_a?(entry, kind) ⇒ Boolean
Constructor Details
#initialize(root) ⇒ MatchingTree
Returns a new instance of MatchingTree.
97 98 99 100 |
# File 'lib/minitest/filesystem/matcher.rb', line 97 def initialize(root) @root = Pathname.new(root) @tree = @root end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
95 96 97 |
# File 'lib/minitest/filesystem/matcher.rb', line 95 def root @root end |
Instance Method Details
#expand_path(file) ⇒ Object
114 115 116 |
# File 'lib/minitest/filesystem/matcher.rb', line 114 def (file) @root + Pathname.new(file) end |
#follow_link(link) ⇒ Object
118 119 120 |
# File 'lib/minitest/filesystem/matcher.rb', line 118 def follow_link(link) Pathname.new(File.readlink((link))) end |
#has_target?(entry, target) ⇒ Boolean
110 111 112 |
# File 'lib/minitest/filesystem/matcher.rb', line 110 def has_target?(entry, target) (target) == follow_link(entry) end |
#include?(entry) ⇒ Boolean
102 103 104 |
# File 'lib/minitest/filesystem/matcher.rb', line 102 def include?(entry) @tree.include?((entry)) end |
#is_a?(entry, kind) ⇒ Boolean
106 107 108 |
# File 'lib/minitest/filesystem/matcher.rb', line 106 def is_a?(entry, kind) ( entry).send("#{kind}?") end |