facets 3.2.1 → 3.2.2

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: e83c6730d1db66b68b3cad1ff1d18d522e33c0c967a92827fdcc1e90896fd9a0
4
- data.tar.gz: e36061c5e9e99c9aa03ede727764012df8aa54758c29493d75950bb8ff98d14b
3
+ metadata.gz: da62aa5e36dc4d4fbe19984071e7f4bf38acc53a7812c285a50a36b714115f23
4
+ data.tar.gz: 7244c28aff76e1073f723148e6a9e3006246a26cd59c047dab8a2d8f765a3e3d
5
5
  SHA512:
6
- metadata.gz: 65774ae87ae60eaf13b146db1403ba731df7b6c840c37602bb286e67fef3a4f474e0b32b7aee9f967d351667d0d3473627cf8c111113cb0013b7f811f334b5a7
7
- data.tar.gz: 72a213e09c2ba90be9980f6cc300c46f5ba615cddb2e7149fee2c9d83a0b683870478632ee6dfb041dbe792303b9cd3ea7901ce9551a4148e12d3e33f7e6d7e8
6
+ metadata.gz: acc7199da1618757142fede6aece2bdbc324a7d8d95525f4ff40a0ef1085484ec42d3727eb3adcd65be3eccfa210e599d1488dafde8640b04375947b6df96c7b
7
+ data.tar.gz: 0e561c34ccac85af4fa6b1ce7c28a2396d4326ff75917b6fde31c6618be7cdb46c959fec59454b1a6b4df5a2c3a6812cae72c68ce5bd0a96714afa1dc43bd344
data/HISTORY.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Facets Release History
2
2
 
3
+ ## 3.2.2 / 2026-06-15
4
+
5
+ Patch release with cross-version fixes surfaced by CI on Ruby 3.1–3.4.
6
+
7
+ Changes:
8
+
9
+ * Bug Fixes
10
+
11
+ * Fix `Range.intersection` on Ruby 3.1 and 3.2. It relied on `Range#overlap?`,
12
+ which only exists in Ruby 3.3+; replaced with an explicit overlap test that
13
+ works on any Ruby and any comparable element type.
14
+ * Restore `Range#overlap?` for Ruby < 3.3. It was dropped in 3.2.0 (since Ruby
15
+ 3.3 added a native one), which left 3.1/3.2 users without it. It is now
16
+ defined only when missing, so it never replaces the built-in on 3.3+.
17
+ * Widen `Binding#caller` and `Binding#caller_locations` to accept the optional
18
+ `length` argument (matching `Kernel#caller`/`#caller_locations`). The
19
+ too-narrow arity raised `ArgumentError` when `warn(uplevel:)` dispatched to
20
+ them under JRuby's pure-Ruby `warn`.
21
+
22
+ * Internal
23
+
24
+ * Add `ostruct` to the test dependencies. `ostruct` is deprecated in Ruby 3.4
25
+ and removed from the default gems in Ruby 3.5, so it must be declared
26
+ explicitly. Facets' OpenStruct extensions (`require 'facets/ostruct'`) still
27
+ work, but now require the `ostruct` gem to be installed on Ruby 3.5+. These
28
+ extensions may be divested from Facets in a future release.
29
+
3
30
  ## 3.2.1 / 2026-06-14
4
31
 
5
32
  Patch release that fixes the broken 3.2.0 release. 3.2.0 shipped with stale
@@ -4,14 +4,18 @@ class Binding
4
4
 
5
5
  # Returns the call stack, same format as Kernel#caller()
6
6
  #
7
- def caller( skip=0 )
8
- eval("caller(#{skip})")
7
+ # Accepts the same `(start, length)` arguments as Kernel#caller.
8
+ #
9
+ def caller( start=0, length=nil )
10
+ length ? eval("caller(#{start}, #{length})") : eval("caller(#{start})")
9
11
  end
10
12
 
11
13
  # Returns the call stack, same format as Kernel#caller_locations()
12
14
  #
13
- def caller_locations( skip=0 )
14
- eval("caller_locations(#{skip})")
15
+ # Accepts the same `(start, length)` arguments as Kernel#caller_locations.
16
+ #
17
+ def caller_locations( start=0, length=nil )
18
+ length ? eval("caller_locations(#{start}, #{length})") : eval("caller_locations(#{start})")
15
19
  end
16
20
 
17
21
  # Return the line number on which the binding was created.
@@ -21,7 +21,8 @@ class Range
21
21
  def self.intersection(*ranges)
22
22
  return nil if ranges.empty?
23
23
  ranges.reduce do |result, r|
24
- return nil unless result.overlap?(r)
24
+ # Manual overlap test (Range#overlap? is Ruby 3.3+; Facets targets 3.1+).
25
+ return nil unless result.first <= r.last && r.first <= result.last
25
26
  new_first = result.first > r.first ? result.first : r.first
26
27
  new_last = result.last < r.last ? result.last : r.last
27
28
  new_first..new_last
@@ -0,0 +1,19 @@
1
+ class Range
2
+
3
+ # Do two ranges overlap?
4
+ #
5
+ # (1..5).overlap?(3..8) #=> true
6
+ # (1..5).overlap?(6..8) #=> false
7
+ #
8
+ # Ruby 3.3 added a native Range#overlap?, so only define Facets' version
9
+ # on older Rubies that lack it -- this avoids replacing the built-in.
10
+ #
11
+ # CREDIT: Daniel Schierbeck, Brandon Keepers
12
+
13
+ unless method_defined?(:overlap?)
14
+ def overlap?(other)
15
+ include?(other.first) or other.include?(first)
16
+ end
17
+ end
18
+
19
+ end
@@ -1,4 +1,5 @@
1
1
  require_relative 'range/combine.rb'
2
+ require_relative 'range/overlap.rb'
2
3
  #require_relative 'range/intersection.rb' # too new
3
4
  #require_relative 'range/quantile.rb' # uncommon
4
5
  #require_relative 'range/op_add.rb' # too new
@@ -1,3 +1,3 @@
1
1
  module Facets
2
- VERSION = '3.2.1'
2
+ VERSION = '3.2.2'
3
3
  end
@@ -1,3 +1,13 @@
1
+ # Facets' extensions to Ruby's OpenStruct.
2
+ #
3
+ # NOTE: `ostruct` is deprecated as of Ruby 3.4 and is no longer a default gem
4
+ # as of Ruby 3.5 — it must be installed/declared explicitly to be available
5
+ # (`gem install ostruct`, or add `ostruct` to your Gemfile/gemspec). The gem
6
+ # itself still exists, so these extensions continue to work on top of it.
7
+ #
8
+ # Given OpenStruct's deprecation, Facets may divest these extensions in a
9
+ # future release.
10
+
1
11
  require 'ostruct'
2
12
  require 'facets/ostruct/initialize'
3
13
  require 'facets/ostruct/to_ostruct'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Sawyer
@@ -451,6 +451,7 @@ files:
451
451
  - lib/core/facets/range/nudge.rb
452
452
  - lib/core/facets/range/op_add.rb
453
453
  - lib/core/facets/range/op_sub.rb
454
+ - lib/core/facets/range/overlap.rb
454
455
  - lib/core/facets/range/quantile.rb
455
456
  - lib/core/facets/range/to_rng.rb
456
457
  - lib/core/facets/range/umbrella.rb