src/lib.rs in faster_path-0.2.1 vs src/lib.rs in faster_path-0.2.2
- old
+ new
@@ -7,10 +7,11 @@
#[macro_use]
extern crate ruru;
class!(FasterPathname);
+mod helpers;
mod pathname;
mod basename;
mod chop_basename;
mod dirname;
mod extname;
@@ -24,27 +25,10 @@
// pub_ methods must take all values as parameters
methods!(
FasterPathname,
_itself,
- // TOPATH = :to_path
-
- // SAME_PATHS = if File::FNM_SYSCASE.nonzero?
- // # Avoid #zero? here because #casecmp can return nil.
- // proc {|a, b| a.casecmp(b) == 0}
- // else
- // proc {|a, b| a == b}
- // end
-
- // if File::ALT_SEPARATOR
- // SEPARATOR_LIST = "#{Regexp.quote File::ALT_SEPARATOR}#{Regexp.quote File::SEPARATOR}"
- // SEPARATOR_PAT = /[#{SEPARATOR_LIST}]/
- // else
- // SEPARATOR_LIST = "#{Regexp.quote File::SEPARATOR}"
- // SEPARATOR_PAT = /#{Regexp.quote File::SEPARATOR}/
- // end
-
fn pub_add_trailing_separator(pth: RString) -> RString {
pathname::pn_add_trailing_separator(pth)
}
fn pub_is_absolute(pth: RString) -> Boolean {
@@ -59,10 +43,14 @@
fn pub_children(pth: RString, with_dir: Boolean) -> Array {
pathname::pn_children(pth, with_dir)
}
+ fn pub_children_compat(pth: RString, with_dir: Boolean) -> Array {
+ pathname::pn_children_compat(pth, with_dir)
+ }
+
fn pub_chop_basename(pth: RString) -> Array {
pathname::pn_chop_basename(pth)
}
// fn r_cleanpath(){ pub_cleanpath(r_to_path()) }
@@ -89,14 +77,20 @@
// fn pub_each_filename(pth: RString) -> NilClass {
// pathname::pn_each_filename(pth)
// }
+ // pub_entries returns an array of String objects
fn pub_entries(pth: RString) -> Array {
pathname::pn_entries(pth)
}
+ // pub_entries_compat returns an array of Pathname objects
+ fn pub_entries_compat(pth: RString) -> Array {
+ pathname::pn_entries_compat(pth)
+ }
+
fn pub_extname(pth: RString) -> RString {
pathname::pn_extname(pth)
}
// fn r_find(ignore_error: Boolean){}
@@ -155,13 +149,15 @@
Class::from_existing("FasterPathname").get_nested_class("Public").define(|itself| {
itself.def("absolute?", pub_is_absolute);
itself.def("add_trailing_separator", pub_add_trailing_separator);
itself.def("basename", pub_basename);
itself.def("children", pub_children);
+ itself.def("children_compat", pub_children_compat);
itself.def("chop_basename", pub_chop_basename);
itself.def("directory?", pub_is_directory);
itself.def("dirname", pub_dirname);
itself.def("entries", pub_entries);
+ itself.def("entries_compat", pub_entries_compat);
itself.def("extname", pub_extname);
itself.def("has_trailing_separator?", pub_has_trailing_separator);
itself.def("plus", pub_plus);
itself.def("relative?", pub_is_relative);
});