Sha256: dceb611733fb2f6ad78d218e60f3e90f4da3022acd73f847603d6622c7d448b5

Contents?: true

Size: 709 Bytes

Versions: 8

Compression:

Stored size: 709 Bytes

Contents

module Polyfill
  module V2_5
    module Dir
      module ClassMethods
        def children(dirname, encoding: Encoding.find('filesystem'))
          entries(dirname, encoding: encoding) - %w[. ..]
        end

        def each_child(dirname, encoding: Encoding.find('filesystem'))
          unless block_given?
            return ::Enumerator.new do |yielder|
              (entries(dirname, encoding: encoding) - %w[. ..]).each do |filename|
                yielder.yield(filename)
              end
            end
          end

          (entries(dirname, encoding: encoding) - %w[. ..]).each do |filename|
            yield(filename)
          end

          nil
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
polyfill-1.9.0 lib/polyfill/v2_5/dir.rb
polyfill-1.8.0 lib/polyfill/v2_5/dir.rb
polyfill-1.7.0 lib/polyfill/v2_5/dir.rb
polyfill-1.6.0 lib/polyfill/v2_5/dir.rb
polyfill-1.5.0 lib/polyfill/v2_5/dir.rb
polyfill-1.4.0 lib/polyfill/v2_5/dir.rb
polyfill-1.3.0 lib/polyfill/v2_5/dir.rb
polyfill-1.2.0 lib/polyfill/v2_5/dir.rb