google_hash 0.6.0 → 0.6.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -316,7 +316,8 @@ static VALUE rb_ghash_combination_2(VALUE cb) {
316
316
  void init_<%= type %>_<%= english_key_type %>_to_<%= english_value_type %>() {
317
317
 
318
318
  VALUE rb_cGoogleHashLocal;
319
- rb_cGoogleHashLocal = rb_define_class("GoogleHash<%= type.capitalize %><%= english_key_type.capitalize %>To<%= english_value_type.capitalize %>", rb_cObject);
319
+ <% class_name = "GoogleHash#{type.capitalize + english_key_type.capitalize}To#{english_value_type.capitalize}" %>
320
+ rb_cGoogleHashLocal = rb_define_class("<%= class_name %>", rb_cObject);
320
321
 
321
322
  rb_define_alloc_func(rb_cGoogleHashLocal, callback_alloc); // I guess it calls this for us, pre initialize...
322
323
 
@@ -332,6 +333,8 @@ void init_<%= type %>_<%= english_key_type %>_to_<%= english_value_type %>() {
332
333
  rb_define_method(rb_cGoogleHashLocal, "include?", RUBY_METHOD_FUNC(rb_ghash_get_present), 1);
333
334
  rb_define_method(rb_cGoogleHashLocal, "keys_combination_2", RUBY_METHOD_FUNC(rb_ghash_combination_2), 0);
334
335
  rb_define_method(rb_cGoogleHashLocal, "length", RUBY_METHOD_FUNC(rb_ghash_size), 0);
336
+ // add a higher quality #inspect...
337
+ rb_eval_string("class <%= class_name %>;def inspect;all = '<%= class_name %> {'; join = []; self.each{|k, v| join << (k.to_s + '=>' + v.to_s)}; all << join.join(',') << '}'; end; end");
335
338
  id_eql = rb_intern("eql?");
336
339
  id_hash = rb_intern("hash");
337
340
  }
@@ -248,6 +248,13 @@ describe "google_hash" do
248
248
  a.each_key {}
249
249
  end
250
250
 
251
+ it "should have nice inspect" do
252
+ a = GoogleHashSparseIntToRuby.new
253
+ a[3] = 4
254
+ a[4] = 5
255
+ a.inspect.should == "GoogleHashSparseIntToRuby {3=>4,4=>5}"
256
+ end
257
+
251
258
  it "should have sets, too, not just hashes"
252
259
 
253
260
  it "should skip GC when native to native" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - rogerdpack