lib/faster_path/optional/monkeypatches.rb in faster_path-0.1.13 vs lib/faster_path/optional/monkeypatches.rb in faster_path-0.2.0
- old
+ new
@@ -1,14 +1,15 @@
require 'pathname'
module FasterPath
module MonkeyPatches
# rubocop:disable Metrics/CyclomaticComplexity
+ # rubocop:disable Metrics/PerceivedComplexity
def self._ruby_core_file!
::File.class_eval do
def self.basename(pth, ext = '')
pth = pth.to_path if pth.respond_to? :to_path
- raise TypeError unless pth.is_a? String
+ raise TypeError unless pth.is_a?(String) && ext.is_a?(String)
FasterPath.basename(pth, ext)
end
def self.extname(pth)
pth = pth.to_path if pth.respond_to? :to_path