Class: Puppet::FileServing::Fileset::FileSetEntry Private
- Defined in:
- lib/puppet/file_serving/fileset.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #basename ⇒ Object private
- #children ⇒ Object private
- #directory? ⇒ Boolean private
- #down_level(to) ⇒ Object private
- #ignore?(child) ⇒ Boolean private
Instance Method Details
#basename ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
131 132 133 |
# File 'lib/puppet/file_serving/fileset.rb', line 131 def basename File.basename(path) end |
#children ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
135 136 137 138 139 140 141 |
# File 'lib/puppet/file_serving/fileset.rb', line 135 def children return [] unless directory? Dir.entries(path, encoding: Encoding::UTF_8). reject { |child| ignore?(child) }. collect { |child| down_level(child) } end |
#directory? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
150 151 152 153 154 |
# File 'lib/puppet/file_serving/fileset.rb', line 150 def directory? Puppet::FileSystem.send(stat_method, path).directory? rescue Errno::ENOENT, Errno::EACCES false end |
#down_level(to) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
127 128 129 |
# File 'lib/puppet/file_serving/fileset.rb', line 127 def down_level(to) FileSetEntry.new(depth + 1, File.join(path, to), ignored, stat_method) end |
#ignore?(child) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
143 144 145 146 147 148 |
# File 'lib/puppet/file_serving/fileset.rb', line 143 def ignore?(child) return true if child == "." || child == ".." return false if ignored == [nil] ignored.any? { |pattern| File.fnmatch?(pattern, child) } end |