aboutsummaryrefslogtreecommitdiffstats
path: root/ext/pathname/pathname.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pathname/pathname.c')
-rw-r--r--ext/pathname/pathname.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index 7b801a1c0b..f437d7f859 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -119,6 +119,13 @@ path_cmp(VALUE self, VALUE other)
return INT2FIX(0);
}
+/* :nodoc: */
+static VALUE
+path_hash(VALUE self)
+{
+ return INT2FIX(rb_str_hash(get_strpath(self)));
+}
+
/*
* == Pathname
*
@@ -311,4 +318,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "===", path_eq, 1);
rb_define_method(rb_cPathname, "eql?", path_eq, 1);
rb_define_method(rb_cPathname, "<=>", path_cmp, 1);
+ rb_define_method(rb_cPathname, "hash", path_hash, 0);
}