Module: OTS
- Defined in:
- ext/ots.c
Defined Under Namespace
Classes: Article
Constant Summary collapse
- VERSION =
rb_str_new2(RUBY_OTS_VERSION)
Class Method Summary collapse
Class Method Details
.languages ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'ext/ots.c', line 157
VALUE ots_languages(VALUE self) {
DIR *dir;
struct dirent *entry;
VALUE languages = rb_ary_new();
if ((dir = opendir(DICTIONARY_DIR))) {
while ((entry = readdir(dir))) {
// entry->d_type is not portable.
if (strstr(entry->d_name, ".xml"))
rb_ary_push(languages, rb_str_new(entry->d_name, strlen(entry->d_name) - 4));
}
}
else {
rb_raise(rb_eIOError, "unable to open dictionary directory: %s", strerror(errno));
}
closedir(dir);
return languages;
}
|
.parse(*args) ⇒ Object
151 152 153 154 155 |
# File 'ext/ots.c', line 151
VALUE ots_parse(int argc, VALUE *argv, VALUE self) {
VALUE article = article_allocate(cArticle);
article_initialize(argc, argv, article);
return article;
}
|