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.
130 131 132 |
# File 'lib/puppet/file_serving/fileset.rb', line 130 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.
134 135 136 137 138 139 140 |
# File 'lib/puppet/file_serving/fileset.rb', line 134 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.
149 150 151 152 153 |
# File 'lib/puppet/file_serving/fileset.rb', line 149 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.
126 127 128 |
# File 'lib/puppet/file_serving/fileset.rb', line 126 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.
142 143 144 145 146 147 |
# File 'lib/puppet/file_serving/fileset.rb', line 142 def ignore?(child) return true if child == "." || child == ".." return false if ignored == [nil] ignored.any? { |pattern| File.fnmatch?(pattern, child) } end |