Sha256: 7732b6fb77c08fbe15017c038d04c20ca86c3f0cd674ec04c1f3e8c14c7158ca

Contents?: true

Size: 646 Bytes

Versions: 39

Compression:

Stored size: 646 Bytes

Contents

require 'pathname'

if RUBY_VERSION.to_f < 1.9
  class Pathname
    @@old_each_filename = instance_method(:each_filename)

    def each_filename(&block)
      if block_given?
        EachFilenameEnumerable.new(self).each(&block)
      else
        EachFilenameEnumerable.new(self)
      end
    end

    def old_each_filename(&block)
      @@old_each_filename.bind(self).call(&block)
    end

    class EachFilenameEnumerable
      include Enumerable
      attr_reader :pathname

      def initialize(pathname)
        @pathname = pathname
      end

      def each(&block)
        @pathname.old_each_filename(&block)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
chef-11.18.12-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-11.18.12 lib/chef/monkey_patches/pathname.rb
chef-11.18.6-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-11.18.6 lib/chef/monkey_patches/pathname.rb
chef-11.18.0-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-11.18.0 lib/chef/monkey_patches/pathname.rb
chef-12.0.3-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-12.0.3 lib/chef/monkey_patches/pathname.rb
chef-12.0.1-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-12.0.1 lib/chef/monkey_patches/pathname.rb
chef-12.0.0-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-12.0.0 lib/chef/monkey_patches/pathname.rb
chef-12.0.0.rc.0-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-12.0.0.rc.0 lib/chef/monkey_patches/pathname.rb
chef-11.16.4-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-11.16.4 lib/chef/monkey_patches/pathname.rb
chef-11.16.2-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-11.16.2 lib/chef/monkey_patches/pathname.rb
chef-12.0.0.alpha.2-x86-mingw32 lib/chef/monkey_patches/pathname.rb
chef-12.0.0.alpha.2 lib/chef/monkey_patches/pathname.rb