src/lib.rs in faster_path-0.2.4 vs src/lib.rs in faster_path-0.2.5
- old
+ new
@@ -15,21 +15,23 @@
mod helpers;
mod pathname;
mod basename;
mod chop_basename;
mod cleanpath_aggressive;
+mod cleanpath_conservative;
mod dirname;
mod extname;
+mod pathname_sys;
mod plus;
mod prepend_prefix;
pub mod rust_arch_bits;
mod path_parsing;
use ruru::{Module, Object, RString, Boolean, Array, AnyObject};
-// r_ methods are on the core class and may evaluate instance variables or self
-// pub_ methods must take all values as parameters
+use pathname_sys::*;
+
methods!(
FasterPath,
_itself,
fn pub_add_trailing_separator(pth: RString) -> RString {
@@ -63,13 +65,17 @@
fn pub_cleanpath_aggressive(pth: RString) -> RString {
pathname::pn_cleanpath_aggressive(pth)
}
- // fn r_cleanpath_conservative(pth: RString){}
+ fn pub_cleanpath_conservative(pth: RString) -> RString {
+ pathname::pn_cleanpath_conservative(pth)
+ }
- // fn r_del_trailing_separator(pth: RString){}
+ fn pub_del_trailing_separator(pth: RString) -> RString {
+ pathname::pn_del_trailing_separator(pth)
+ }
// fn r_descend(){}
fn pub_is_directory(pth: RString) -> Boolean {
pathname::pn_is_directory(pth)
@@ -105,12 +111,10 @@
fn pub_has_trailing_separator(pth: RString) -> Boolean {
pathname::pn_has_trailing_separator(pth)
}
- // fn r_join(args: Array){}
-
// fn pub_mkpath(pth: RString) -> NilClass {
// pathname::pn_mkpath(pth)
// }
// fn r_is_mountpoint(){ pub_is_mountpount(r_to_path()) }
@@ -147,14 +151,18 @@
#[no_mangle]
pub extern "C" fn Init_faster_pathname(){
Module::from_existing("FasterPath").define(|itself| {
itself.def_self("absolute?", pub_is_absolute);
itself.def_self("add_trailing_separator", pub_add_trailing_separator);
+ itself.def_self("del_trailing_separator", pub_del_trailing_separator);
itself.def_self("cleanpath_aggressive", pub_cleanpath_aggressive);
+ itself.def_self("cleanpath_conservative", pub_cleanpath_conservative);
itself.def_self("directory?", pub_is_directory);
itself.def_self("dirname", pub_dirname);
itself.def_self("extname", pub_extname);
itself.def_self("has_trailing_separator?", pub_has_trailing_separator);
+ //itself.def_self("join", pub_join);
+ pathname_sys::define_singleton_method(itself.value(), "join", pub_join);
itself.def_self("plus", pub_plus);
itself.def_self("relative?", pub_is_relative);
itself.define_nested_class("Public", None);
});