Method: Chef::ChefFS::FilePattern#match?
- Defined in:
- lib/chef/chef_fs/file_pattern.rb
#match?(path) ⇒ Boolean
Returns <tt>true+ if this pattern matches the path, <tt>false+ otherwise.
abc/*/def.match?('abc/foo/def') == true
abc/*/def.match?('abc/foo') == false
155 156 157 158 159 160 161 |
# File 'lib/chef/chef_fs/file_pattern.rb', line 155 def match?(path) argument_is_absolute = Chef::ChefFS::PathUtils.is_absolute?(path) return false if is_absolute != argument_is_absolute path = path[1, path.length - 1] if argument_is_absolute !!regexp.match(path) end |