Skip to content

Commit a0f35fa

Browse files
committed
Make last parameter a string
1 parent a7a087e commit a0f35fa

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/faster_path/optional/monkeypatches.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def relative?
8989
end
9090

9191
def relative_path_from(other)
92-
FasterPath.relative_path_from(@path, Pathname(other))
92+
FasterPath.relative_path_from(@path, other)
9393
end
9494
end
9595
end

lib/faster_path/optional/refinements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def relative?
8484
end
8585

8686
def relative_path_from(other)
87-
FasterPath.relative_path_from(@path, Pathname(other))
87+
FasterPath.relative_path_from(@path, other)
8888
end
8989
end
9090
end

src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ methods!(
146146

147147
// fn r_split_names(pth: RString){}
148148

149-
fn pub_relative_path_from(itself: RString, base_directory: RString) -> Pathname {
150-
pathname::pn_relative_path_from(itself, base_directory).map_err(|e| {
151-
raise(e);
152-
}).unwrap()
149+
fn pub_relative_path_from(itself: RString, base_directory: AnyObject) -> Pathname {
150+
let to_string = |i: AnyObject| { RString::from(i.send("to_s", None).value()) };
151+
152+
pathname::pn_relative_path_from(itself, base_directory.map(to_string)).
153+
map_err(|e| raise(e) ).unwrap()
153154
}
154155

155156
// fn pub_rmtree(pth: RString) -> NilClass {

0 commit comments

Comments
 (0)