Sha256: b32deb8417e764c52a57e6559dff8c9503a7531ecdc6c560a2209a5af99ebe9f

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'pathname'

module FasterPath
  def self.sledgehammer_everything!
    ::File.class_eval do
      def self.basename(pth, ext = '')
        FasterPath.basename(pth, ext)
      end if ENV['WITH_REGRESSION']

      def self.extname(pth)
        FasterPath.extname(pth)
      end if ENV['WITH_REGRESSION']

      def self.dirname(pth)
        FasterPath.dirname(pth)
      end if ENV['WITH_REGRESSION']
    end

    ::Pathname.class_eval do
      def absolute?
        FasterPath.absolute?(@path)
      end

      def directory?
        FasterPath.directory?(@path)
      end

      def chop_basename(pth)
        FasterPath.chop_basename(pth)
      end
      private :chop_basename

      def relative?
        FasterPath.relative?(@path)
      end

      def add_trailing_separator(pth)
        FasterPath.add_trailing_separator(pth)
      end
      private :add_trailing_separator

      def has_trailing_separator?(pth)
        FasterPath.has_trailing_separator?(pth)
      end
      private :has_trailing_separator?

      def entries
        FasterPath.entries(@path)
      end if ENV['WITH_REGRESSION']
    end
    "CAUTION: Monkey patching effects everything! Be very sure you want this!"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faster_path-0.1.10 lib/faster_path/optional/monkeypatches.rb