/* * call-seq: * root -> TrieNode * * Returns a TrieNode representing the root of the Trie. * */ static VALUE rb_trie_root(VALUE self) { Trie *trie; Data_Get_Struct(self, Trie, trie); VALUE trie_node = rb_trie_node_alloc(cTrieNode); TrieState *state = trie_root(trie); RDATA(trie_node)->data = state; return trie_node; }
/* * call-seq: * root -> TrieNode * * Returns a TrieNode representing the root of the Trie. * */ static VALUE rb_trie_root(VALUE self) { Trie *trie; Data_Get_Struct(self, Trie, trie); VALUE trie_node = rb_trie_node_alloc(cTrieNode); TrieState *state = trie_root(trie); RDATA(trie_node)->data = state; rb_iv_set(trie_node, "@state", Qnil); rb_iv_set(trie_node, "@full_state", rb_str_new2("")); return trie_node; }