fast_trie 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Tyler McMullen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  ---
2
- patch: 5
3
- major: 0
4
- minor: 3
2
+ :patch: 6
3
+ :major: 0
4
+ :minor: 3
5
+ :build:
data/ext/trie/trie.c CHANGED
@@ -28,6 +28,8 @@ static VALUE rb_trie_alloc(VALUE klass) {
28
28
  *
29
29
  */
30
30
  static VALUE rb_trie_has_key(VALUE self, VALUE key) {
31
+ StringValue(key);
32
+
31
33
  Trie *trie;
32
34
  Data_Get_Struct(self, Trie, trie);
33
35
 
@@ -46,6 +48,8 @@ static VALUE rb_trie_has_key(VALUE self, VALUE key) {
46
48
  *
47
49
  */
48
50
  static VALUE rb_trie_get(VALUE self, VALUE key) {
51
+ StringValue(key);
52
+
49
53
  Trie *trie;
50
54
  Data_Get_Struct(self, Trie, trie);
51
55
 
@@ -74,6 +78,8 @@ static VALUE rb_trie_add(VALUE self, VALUE args) {
74
78
 
75
79
  VALUE key;
76
80
  key = RARRAY(args)->ptr[0];
81
+ StringValue(key);
82
+
77
83
  TrieData value = size == 2 ? RARRAY(args)->ptr[1] : TRIE_DATA_ERROR;
78
84
 
79
85
  if(trie_store(trie, (TrieChar*)RSTRING(key)->ptr, value))
@@ -90,6 +96,8 @@ static VALUE rb_trie_add(VALUE self, VALUE args) {
90
96
  *
91
97
  */
92
98
  static VALUE rb_trie_delete(VALUE self, VALUE key) {
99
+ StringValue(key);
100
+
93
101
  Trie *trie;
94
102
  Data_Get_Struct(self, Trie, trie);
95
103
 
@@ -134,6 +142,8 @@ static VALUE rb_trie_children(VALUE self, VALUE prefix) {
134
142
  if(NIL_P(prefix))
135
143
  return rb_ary_new();
136
144
 
145
+ StringValue(prefix);
146
+
137
147
  Trie *trie;
138
148
  Data_Get_Struct(self, Trie, trie);
139
149
 
@@ -210,6 +220,8 @@ static VALUE rb_trie_children_with_values(VALUE self, VALUE prefix) {
210
220
  if(NIL_P(prefix))
211
221
  return rb_ary_new();
212
222
 
223
+ StringValue(prefix);
224
+
213
225
  Trie *trie;
214
226
  Data_Get_Struct(self, Trie, trie);
215
227
 
@@ -330,6 +342,8 @@ static VALUE rb_trie_node_get_full_state(VALUE self) {
330
342
  *
331
343
  */
332
344
  static VALUE rb_trie_node_walk_bang(VALUE self, VALUE rchar) {
345
+ StringValue(rchar);
346
+
333
347
  TrieState *state;
334
348
  Data_Get_Struct(self, TrieState, state);
335
349
 
@@ -357,6 +371,8 @@ static VALUE rb_trie_node_walk_bang(VALUE self, VALUE rchar) {
357
371
  *
358
372
  */
359
373
  static VALUE rb_trie_node_walk(VALUE self, VALUE rchar) {
374
+ StringValue(rchar);
375
+
360
376
  VALUE new_node = rb_funcall(self, rb_intern("dup"), 0);
361
377
 
362
378
  TrieState *state;
data/lib/trie.rb CHANGED
@@ -1 +1 @@
1
- require File.dirname(__FILE__) + '/../ext/trie'
1
+ #require File.dirname(__FILE__) + '/../ext/trie'
data/spec/trie_spec.rb CHANGED
@@ -1,4 +1,6 @@
1
- require File.dirname(__FILE__) + '/../ext/trie/trie'
1
+ #require File.dirname(__FILE__) + '/../ext/trie/trie'
2
+ require 'rubygems'
3
+ require 'trie'
2
4
 
3
5
  describe Trie do
4
6
  before :each do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_trie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler McMullen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-12 00:00:00 -07:00
12
+ date: 2009-11-23 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -19,19 +19,18 @@ executables: []
19
19
 
20
20
  extensions:
21
21
  - ext/trie/extconf.rb
22
- extra_rdoc_files: []
23
-
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.textile
24
25
  files:
25
26
  - README.textile
26
27
  - VERSION.yml
27
- - lib/trie.rb
28
- - spec/trie_spec.rb
28
+ - ext/trie/Makefile
29
29
  - ext/trie/darray.c
30
30
  - ext/trie/darray.h
31
31
  - ext/trie/extconf.rb
32
32
  - ext/trie/fileutils.c
33
33
  - ext/trie/fileutils.h
34
- - ext/trie/Makefile
35
34
  - ext/trie/tail.c
36
35
  - ext/trie/tail.h
37
36
  - ext/trie/trie-private.c
@@ -40,6 +39,9 @@ files:
40
39
  - ext/trie/trie.h
41
40
  - ext/trie/triedefs.h
42
41
  - ext/trie/typedefs.h
42
+ - lib/trie.rb
43
+ - spec/trie_spec.rb
44
+ - LICENSE
43
45
  has_rdoc: true
44
46
  homepage: http://github.com/tyler/trie
45
47
  licenses: []
@@ -74,7 +76,7 @@ requirements: []
74
76
  rubyforge_project:
75
77
  rubygems_version: 1.3.5
76
78
  signing_key:
77
- specification_version: 2
79
+ specification_version: 3
78
80
  summary: Ruby Trie based on libdatrie.
79
- test_files: []
80
-
81
+ test_files:
82
+ - spec/trie_spec.rb