Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Pathname#each_entry
() { (::Pathname) -> untyped } -> nil
each_entry {|entry| ... } → nil
each_entry → new_enumerator
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2882
def each_entry(&block) # :yield: pathname
return to_enum(__method__) unless block_given?
Dir.foreach(@path) {|f| yield self.class.new(f) }
end
With a block given, yields a new pathname for each entry in the entry represented by self; returns nil:
Example
Pathname('include').each_entry {|entry| p entry } # #<Pathname:ruby> # #<Pathname:..> # #<Pathname:ruby.h> # #<Pathname:.> # => nil
With no block given, returns a new Enumerator.