lib/faster_path.rb in faster_path-0.1.0 vs lib/faster_path.rb in faster_path-0.1.1

- old
+ new

@@ -6,20 +6,21 @@ # Spec to Pathname#absolute? def self.absolute?(pth) Rust.is_absolute(pth) end + # Spec to Pathname#relative? def self.relative?(pth) Rust.is_relative(pth) end # Spec to Pathname#chop_basename # WARNING! Pathname#chop_basename in STDLIB doesn't handle blank strings correctly! # This implementation correctly handles blank strings just as Pathname had intended # to handle non-path strings. def self.chop_basename(pth) - d,b = [Rust.dirname(pth), Rust.basename(pth)] + d,b = [Rust.dirname_for_chop(pth), Rust.basename_for_chop(pth)] [d,b] unless Rust.both_are_blank(d,b) end def self.blank?(str) Rust.is_blank(str) @@ -51,9 +52,11 @@ attach_function :is_relative, [ :string ], :bool attach_function :is_blank, [ :string ], :bool attach_function :both_are_blank, [ :string, :string ], :bool attach_function :basename, [ :string ], :string attach_function :dirname, [ :string ], :string + attach_function :basename_for_chop, [ :string ], :string # decoupling behavior + attach_function :dirname_for_chop, [ :string ], :string # decoupling behavior # EXAMPLE #attach_function :one_and_two, [], FromRustArray.by_value end private_constant :Rust