Class: Puppet::FileServing::Fileset::FileSetEntry
- Defined in:
- lib/puppet/file_serving/fileset.rb
Instance Method Summary collapse
- #basename ⇒ Object
- #children ⇒ Object
- #directory? ⇒ Boolean
- #down_level(to) ⇒ Object
- #ignore?(child) ⇒ Boolean
Instance Method Details
#basename ⇒ Object
118 119 120 |
# File 'lib/puppet/file_serving/fileset.rb', line 118 def basename File.basename(path) end |
#children ⇒ Object
122 123 124 125 126 127 128 |
# File 'lib/puppet/file_serving/fileset.rb', line 122 def children return [] unless directory? Dir.entries(path). reject { |child| ignore?(child) }. collect { |child| down_level(child) } end |
#directory? ⇒ Boolean
137 138 139 140 141 |
# File 'lib/puppet/file_serving/fileset.rb', line 137 def directory? Puppet::FileSystem.send(stat_method, path).directory? rescue Errno::ENOENT, Errno::EACCES false end |
#down_level(to) ⇒ Object
114 115 116 |
# File 'lib/puppet/file_serving/fileset.rb', line 114 def down_level(to) FileSetEntry.new(depth + 1, File.join(path, to), ignored, stat_method) end |
#ignore?(child) ⇒ Boolean
130 131 132 133 134 135 |
# File 'lib/puppet/file_serving/fileset.rb', line 130 def ignore?(child) return true if child == "." || child == ".." return false if ignored == [nil] ignored.any? { |pattern| File.fnmatch?(pattern, child) } end |