monotonic_grouper 1.0.2 → 1.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e62903ce3c859e0afe9812bcd66fb9125e92f730b8bb8bd0b368c6ace2ab385
4
- data.tar.gz: c0a730777117df24089ccfbb799c152a54822ca1be1b9f7f84e27699d83d4fce
3
+ metadata.gz: 819f3771c8e8b3153fece915aa61a2fdf43704303a32da8df659956e73e0c96c
4
+ data.tar.gz: fe9f394e978b8891707820596796b5afb8fdf582d8161c53d35a6ba26e9f1705
5
5
  SHA512:
6
- metadata.gz: ad1a76ec922ef77511a8b7ed5ecc9fbd5325411c9e5cfec491ae0ba651026486e550f0242125c5ddb0d5f4d05b8b1b23ae608efe7d86f1f0a8860981783a7c4c
7
- data.tar.gz: ddfeddfebb196f6140631ebc492c83704191e75399f2a8586c1a1990d6829213c368796b0fcabe189753a4b187e22ed02d46f6f3b99e41609ae8099acc6e73eb
6
+ metadata.gz: 8857b22b3eb7c359024e2d51553f1cac2eed3fccdacfff17683ff7b562af4e2bb4c0815e4ee43b613ecfc98daeb4bd473d456d8a2fe5aacff37e2a63ee34655c
7
+ data.tar.gz: 3c631ea4f2e72fc3142ec3acf16a94b8f1b7bdbf78170b6e4b84fb1de44e59dec79e2cdcc4060b5a1edc0430ca919d0be73ff0b0b1e3073f351d0b6504ac343a
@@ -123,8 +123,6 @@ process_date_array(VALUE self, long len, long min_range_size, VALUE first_elem)
123
123
  VALUE first_class = CLASS_OF(first_elem);
124
124
  long current_size = 1;
125
125
  long i;
126
-
127
- /* Cache the jd of the previous element to avoid double rb_funcall */
128
126
  long prev_jd = NUM2LONG(rb_funcall(first_elem, id_jd, 0));
129
127
 
130
128
  for (i = 1; i < len; i++) {
@@ -134,7 +132,7 @@ process_date_array(VALUE self, long len, long min_range_size, VALUE first_elem)
134
132
  }
135
133
 
136
134
  long curr_jd = NUM2LONG(rb_funcall(curr_value, id_jd, 0));
137
-
135
+
138
136
  if (curr_jd == prev_jd + 1) {
139
137
  group_end = curr_value;
140
138
  current_size++;
@@ -213,17 +211,14 @@ rb_array_group_monotonic(int argc, VALUE *argv, VALUE self)
213
211
  first_elem = RARRAY_AREF(self, 0);
214
212
  first_class = CLASS_OF(first_elem);
215
213
 
216
- /* Fast path for integers */
217
214
  if (FIXNUM_P(first_elem) || RB_BIGNUM_TYPE_P(first_elem)) {
218
215
  return process_integer_array(self, len, min_range_size);
219
216
  }
220
217
 
221
- /* Fast path for Date objects - use rb_obj_is_kind_of for safer checking */
222
218
  if (rb_cDate != Qnil && rb_obj_is_kind_of(first_elem, rb_cDate)) {
223
219
  return process_date_array(self, len, min_range_size, first_elem);
224
220
  }
225
221
 
226
- /* Generic path for other Comparable types */
227
222
  if (!rb_respond_to(first_elem, id_succ)) {
228
223
  rb_raise(rb_eTypeError, "Elements must respond to :succ method");
229
224
  }
@@ -241,20 +236,15 @@ void
241
236
  Init_monotonic_grouper(void)
242
237
  {
243
238
  int state = 0;
244
-
245
239
  id_succ = rb_intern("succ");
246
240
  id_eq = rb_intern("==");
247
241
  id_jd = rb_intern("jd");
248
-
249
242
  rb_mMonotonicGrouper = rb_define_module("MonotonicGrouper");
250
-
251
- /* Try to get Date class if it's loaded - use rb_protect to handle NameError */
252
243
  rb_cDate = rb_protect(get_date_class, rb_cObject, &state);
253
244
  if (state != 0) {
254
- /* Date class not found, will use generic path */
255
245
  rb_cDate = Qnil;
256
- rb_set_errinfo(Qnil); /* Clear the error */
246
+ rb_set_errinfo(Qnil);
257
247
  }
258
-
248
+
259
249
  rb_define_method(rb_cArray, "group_monotonic", rb_array_group_monotonic, -1);
260
250
  }
@@ -1,3 +1,3 @@
1
1
  module MonotonicGrouper
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'monotonic_grouper/version'
1
+ require_relative 'monotonic_grouper/version'
2
2
 
3
3
  # Load the compiled extension (.so on Linux, .bundle on macOS)
4
4
  begin
@@ -14,37 +14,3 @@ rescue LoadError
14
14
  raise LoadError, "Could not find compiled extension"
15
15
  end
16
16
  end
17
-
18
- module FastBloomFilter
19
- class Filter
20
- def add_all(items)
21
- items.each { |item| add(item.to_s) }
22
- self
23
- end
24
-
25
- def count_possible_matches(items)
26
- items.count { |item| include?(item.to_s) }
27
- end
28
-
29
- def inspect
30
- s = stats
31
- total_kb = (s[:total_bytes] / 1024.0).round(2)
32
- fill_pct = (s[:fill_ratio] * 100).round(2)
33
-
34
- "#<FastBloomFilter::Filter v2 layers=#{s[:num_layers]} " \
35
- "count=#{s[:total_count]} size=#{total_kb}KB fill=#{fill_pct}%>"
36
- end
37
-
38
- def to_s
39
- inspect
40
- end
41
- end
42
-
43
- def self.for_emails(error_rate: 0.001, initial_capacity: 10_000)
44
- Filter.new(error_rate: error_rate, initial_capacity: initial_capacity)
45
- end
46
-
47
- def self.for_urls(error_rate: 0.01, initial_capacity: 10_000)
48
- Filter.new(error_rate: error_rate, initial_capacity: initial_capacity)
49
- end
50
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monotonic_grouper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Hajdarov