* file.c (file_load_ok): use eaccess() instead of actually opening
the file. [ruby-talk:156378] * lib/jcode.rb (String::reverse): add new methods. [ruby-list:41245] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
011e0a5148
commit
d0f784a071
@ -1,3 +1,11 @@
|
|||||||
|
Tue Nov 15 16:15:23 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* file.c (file_load_ok): use eaccess() instead of actually opening
|
||||||
|
the file. [ruby-talk:156378]
|
||||||
|
|
||||||
|
* lib/jcode.rb (String::reverse): add new methods.
|
||||||
|
[ruby-list:41245]
|
||||||
|
|
||||||
Tue Nov 15 15:49:34 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
Tue Nov 15 15:49:34 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
* array.c (rb_ary_fill): tail elements were vanished when the middle
|
* array.c (rb_ary_fill): tail elements were vanished when the middle
|
||||||
|
10
file.c
10
file.c
@ -3954,15 +3954,9 @@ is_macos_native_path(const char *path)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
file_load_ok(const char *file)
|
file_load_ok(const char *path)
|
||||||
{
|
{
|
||||||
FILE *f;
|
return eaccess(path, R_OK);
|
||||||
|
|
||||||
if (!file) return 0;
|
|
||||||
f = fopen(file, "r");
|
|
||||||
if (f == NULL) return 0;
|
|
||||||
fclose(f);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern VALUE rb_load_path;
|
extern VALUE rb_load_path;
|
||||||
|
@ -188,6 +188,15 @@ class String
|
|||||||
(str = self.dup).tr_s!(from,to) or str
|
(str = self.dup).tr_s!(from,to) or str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reverse
|
||||||
|
self.split(//).reverse.join
|
||||||
|
end
|
||||||
|
|
||||||
|
def reverse!
|
||||||
|
self.replace(self.reverse)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
def chop!
|
def chop!
|
||||||
self.gsub!(/(?:.|\r?\n)\z/, '')
|
self.gsub!(/(?:.|\r?\n)\z/, '')
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user