Module: Thesaurus
- Extended by:
- Thesaurus
- Included in:
- Thesaurus
- Defined in:
- lib/thesaurus.rb,
lib/thesaurus/version.rb,
ext/thesaurus/thesaurus.c
Defined Under Namespace
Classes: Entry
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
._lookup(pattern) ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'ext/thesaurus/thesaurus.c', line 100
VALUE
lookup(VALUE self, VALUE pattern) {
const char *pat = StringValueCStr(pattern);
VALUE dict = rb_iv_get(self, "@dict");
const char *dictFile = StringValueCStr(dict);
search(pat, dictFile, yieldValue);
return Qnil;
}
|
.lookup(word, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/thesaurus.rb', line 7 def self.lookup(word, &block) @dict ||= File.join(__dir__, "words.txt") if block_given? _lookup(word, &block) else to_enum("_lookup", word).map { |line| parse(line) } end end |