mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/pathname/pathname.c (path_hash): Pathname#hash translated
from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
47fd9eb6e1
commit
be2f3c58e6
3 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Jul 30 21:43:55 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/pathname/pathname.c (path_hash): Pathname#hash translated
|
||||
from pathname.rb.
|
||||
|
||||
Fri Jul 30 12:42:02 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/net/imap.rb (example): use IO#noecho to read password if
|
||||
|
|
|
@ -31,10 +31,6 @@ class Pathname
|
|||
|
||||
# :startdoc:
|
||||
|
||||
def hash # :nodoc:
|
||||
@path.hash
|
||||
end
|
||||
|
||||
# Return the path as a String.
|
||||
def to_s
|
||||
@path.dup
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue