[macruby-changes] [2792] MacRuby/trunk/load.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Oct 13 22:12:17 PDT 2009
Revision: 2792
http://trac.macosforge.org/projects/ruby/changeset/2792
Author: lsansonetti at apple.com
Date: 2009-10-13 22:12:15 -0700 (Tue, 13 Oct 2009)
Log Message:
-----------
implement rb_provided()
Modified Paths:
--------------
MacRuby/trunk/load.c
Modified: MacRuby/trunk/load.c
===================================================================
--- MacRuby/trunk/load.c 2009-10-14 02:11:51 UTC (rev 2791)
+++ MacRuby/trunk/load.c 2009-10-14 05:12:15 UTC (rev 2792)
@@ -35,7 +35,14 @@
int
rb_provided(const char *feature)
{
- // TODO
+ VALUE ary = get_loaded_features();
+ for (int i = 0, count = RARRAY_LEN(ary); i < count; i++) {
+ VALUE path = RARRAY_AT(ary, i);
+ // TODO: this is very naive
+ if (strstr(RSTRING_PTR(path), feature) != NULL) {
+ return true;
+ }
+ }
return false;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091013/60db58ff/attachment.html>
More information about the macruby-changes
mailing list