range_extd 1.1 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ef735cf8d777f8f86ab2a5d3654577f06f0b41abf796c5c7147bc23482741dc
4
- data.tar.gz: 33cf0bf6894c7de27b3c2714c03ba3042235751bd2bbeb506c0105c66badd110
3
+ metadata.gz: 228c1335aeaf661aff3db78c73956a09f7f36e172afecb82fc45847d8e719a67
4
+ data.tar.gz: 143bc81562425d744ed187499301f4eb47146ead0930cbc636929829633dab63
5
5
  SHA512:
6
- metadata.gz: 2240719d2e3f7f7933cea2e6b03268b87f0357526851b8a54b1645a320b35a44027808063df2176bbe4ac51ffacc91d517c5999c9c382244ab99a29219bbf795
7
- data.tar.gz: 32f5f4b3cc81aee0bb099a33a6c905e713896eb875dc749cbb6365243f3f81eebfaf75604031a328faa31bbdcc8466956182cef03fe12d4b5d4d2f6fb59db810
6
+ metadata.gz: 57366c3ddc28bdb8c492bb225344018a79b89bdca9a2ea693336733f9b0978d1e4b737e7aacecc674b66fc50a3286542fbc02305998c565ebdef4c652217807e
7
+ data.tar.gz: 063a3be273a83cf001d871e458ecc5bf26e667d97abc997752922e90eca7b22ebde928dac9b84a1e0979fb9c7f5f941e5fca12bbdca73a2cea234a9e33abf3df
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ -----
2
+ (Version: 1.1.1)
3
+ 2020-01-27 Masa Sakano
4
+ * Fixed warnings with Ruby-2.7
5
+
1
6
  -----
2
7
  (Version: 1.1)
3
8
  2019-11-01 Masa Sakano
@@ -361,11 +361,13 @@ existing code in principle.
361
361
 
362
362
  Extensive tests have been performed, as included in the package.
363
363
 
364
-
365
364
  == ToDo
366
365
 
367
366
  Nothing on the horizon.
368
367
 
368
+ == History memo
369
+
370
+ * <tt>((?a..?z) === "cc")</tt> would give false with Ruby 2.6.x or earlier, but true if later.
369
371
 
370
372
  == Final notes
371
373
 
@@ -736,6 +738,10 @@ RangeExtd と別の RangeExtd または Rangeの比較 (<tt><=></tt>) におい
736
738
  特になし。
737
739
 
738
740
 
741
+ == 履歴メモ
742
+
743
+ * <tt>((?a..?z) === "cc")</tt> は、Ruby 2.6.x 以前は false を返していたが、2.7 以降は true を返す。
744
+
739
745
  == 終わりに
740
746
 
741
747
  RangeExtd内部に閉じた(Rangeでなく)挙動、たとえば RangeExtd同士の比較などは、
@@ -220,7 +220,7 @@ politely.
220
220
  For more detail, see its documents (YARD or RDoc-style
221
221
  documents embedded in the code, or see {RubyGems webpage}[http://rubygems.org/gems/range_extd]).
222
222
 
223
- **Note** +RangeExtd::Infinity::POSITIVE+ is practically the same as
223
+ **Note1:** +RangeExtd::Infinity::POSITIVE+ is practically the same as
224
224
  {Endless Range}[https://rubyreferences.github.io/rubychanges/2.6.html#endless-range-1]
225
225
  introduced in Ruby 2.6 released in 2018 December!! In other words,
226
226
  the official Ruby has finally implement a part of this library!
@@ -229,6 +229,28 @@ official Ruby Range (it has no "boundless begin"), and hence this library still
229
229
  supplements the mathematical incompleteness of the standard Range in
230
230
  the official Ruby.
231
231
 
232
+ **Note2:**
233
+ As of Ver.1.1, the +RangeExtd::Infinity+ class instances are not
234
+ comparable with +Float::INFINITY+; for example,
235
+
236
+ RangeExtd::Infinity::POSITIVE != Float::INFINITY # => true
237
+
238
+ Conceptionally, the former is a generalised object of the latter and
239
+ hence they should not be *equal*. See the reference of
240
+ {RangeExtd::Infinity} for detail. Note, the behaviour of Endless Range from Ruby 2.6
241
+ may feel a little odd, as follows:
242
+
243
+ num1 = (5..Float::INFINITY)
244
+ num2 = (5..)
245
+ num1.end != rnum2.end # => true
246
+ num1.size # => Infinity
247
+ num2.size # => Infinity
248
+
249
+ str1 = (?a..)
250
+ str1.end == num2.end # => true (because both are nil)
251
+ str1.size # => nil
252
+
253
+
232
254
  === RangeExtd Class
233
255
 
234
256
  RangeExtd objects are immutable, the same as Range.
@@ -339,11 +361,13 @@ existing code in principle.
339
361
 
340
362
  Extensive tests have been performed, as included in the package.
341
363
 
342
-
343
364
  == ToDo
344
365
 
345
366
  Nothing on the horizon.
346
367
 
368
+ == History memo
369
+
370
+ * <tt>((?a..?z) === "cc")</tt> would give false with Ruby 2.6.x or earlier, but true if later.
347
371
 
348
372
  == Final notes
349
373
 
@@ -377,7 +401,7 @@ Enjoy.
377
401
 
378
402
  == Copyright etc
379
403
 
380
- Author:: Masa Sakano < imagine a_t sakano dot co dot uk >
404
+ Author:: Masa Sakano < info a_t wisebabel dot com >
381
405
  License:: MIT.
382
406
  Warranty:: No warranty whatsoever.
383
407
  Versions:: The versions of this package follow Semantic Versioning (2.0.0) http://semver.org/
@@ -714,6 +738,10 @@ RangeExtd と別の RangeExtd または Rangeの比較 (<tt><=></tt>) におい
714
738
  特になし。
715
739
 
716
740
 
741
+ == 履歴メモ
742
+
743
+ * <tt>((?a..?z) === "cc")</tt> は、Ruby 2.6.x 以前は false を返していたが、2.7 以降は true を返す。
744
+
717
745
  == 終わりに
718
746
 
719
747
  RangeExtd内部に閉じた(Rangeでなく)挙動、たとえば RangeExtd同士の比較などは、
@@ -742,7 +770,7 @@ RangeExtd内部に閉じた(Rangeでなく)挙動、たとえば RangeExtd同士
742
770
 
743
771
  == 著作権他情報
744
772
 
745
- 著者:: Masa Sakano < imagine a_t sakano dot co dot uk >
773
+ 著者:: Masa Sakano < info a_t wisebabel dot com >
746
774
  利用許諾条項:: MIT.
747
775
  保証:: 一切無し。
748
776
  バージョン:: Semantic Versioning (2.0.0) http://semver.org/
@@ -135,7 +135,7 @@ class RangeExtd < Range
135
135
  end
136
136
 
137
137
  # Note: the order of exclude_begin? and end? is reversed from the input!
138
- arout = RangeExtd.send(:_get_init_args, *inar, hsopt)
138
+ arout = RangeExtd.send(:_get_init_args, *inar, **hsopt)
139
139
  # == [RangeBeginValue, RangeEndValue, exclude_end?, exclude_begin?]
140
140
 
141
141
  ### The following routine is obsolete.
@@ -1620,7 +1620,11 @@ end # class Range
1620
1620
  # Constant-form of {#RangeExtd}.
1621
1621
  # #RangeExtd(*) is equivalent to {#RangeExtd.new}.
1622
1622
  #
1623
- def RangeExtd(*rest, &b)
1624
- RangeExtd.new(*rest, &b)
1623
+ # NOTE:
1624
+ # "warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call"
1625
+ # is raised if '**hs*' is completely omitted. I do not know how to
1626
+ # deal with this, other than adding **hs.
1627
+ def RangeExtd(*rest, **hs, &b)
1628
+ RangeExtd.new(*rest, **hs, &b)
1625
1629
  end
1626
1630
 
@@ -356,7 +356,7 @@ gem "minitest"
356
356
  end
357
357
 
358
358
  # Ruby 2.6 upwards
359
- ra00 = (-2..)
359
+ ra00 = (-2..) # This raises the uncapturable SyntaxError for Ruby 2.5 and before anyway.
360
360
  rae0 = RangeExtd.new(ra00)
361
361
  assert rae0.valid?
362
362
  assert_equal(-2, rae0.begin)
@@ -384,7 +384,7 @@ gem "minitest"
384
384
  end
385
385
 
386
386
  # Ruby 2.6 upwards
387
- ra00 = (Float::INFINITY...)
387
+ ra00 = (Float::INFINITY...) # This raises the uncapturable SyntaxError for Ruby 2.5 and before anyway.
388
388
  rae0 = RangeExtd.new(ra00)
389
389
  assert rae0.valid?
390
390
  assert_equal Float::INFINITY, rae0.begin
@@ -416,7 +416,7 @@ gem "minitest"
416
416
  return # Before Ruby 2.6
417
417
  end
418
418
 
419
- ra00 = (-Float::INFINITY...)
419
+ ra00 = (-Float::INFINITY...) # This raises the uncapturable SyntaxError for Ruby 2.5 and before anyway.
420
420
  rae0 = RangeExtd.new(ra00)
421
421
  assert rae0.valid?
422
422
  assert_equal(-Float::INFINITY, rae0.begin)
@@ -533,7 +533,7 @@ gem "minitest"
533
533
  assert_output('', /Infinity/i){RaE(RangeExtd::Infinity::NEGATIVE, Float::INFINITY)} # Warning = "RangeExtd component of the RangeExtd::Infinity object replaced with Float::INFINITY"
534
534
  capture_io{
535
535
  ra_b = RaE(InfN, InfF).begin # RangeExtd::Infinity::NEGATIVE replaced with -Float::INFINITY
536
- assert_equal -InfF, ra_b
536
+ assert_equal( -InfF, ra_b)
537
537
  assert_operator Float, '===', ra_b
538
538
  }
539
539
 
@@ -570,7 +570,7 @@ gem "minitest"
570
570
  end
571
571
 
572
572
  def test_new_invalid_endless_range01
573
- ra00 = (nil..)
573
+ ra00 = (nil..) # This raises the uncapturable SyntaxError for Ruby 2.5 and before anyway.
574
574
  refute RangeExtd.valid?(ra00)
575
575
  assert_raises(RangeError){ RangeExtd.new(ra00) }
576
576
 
@@ -1257,7 +1257,7 @@ gem "minitest"
1257
1257
 
1258
1258
  # For Ruby 2.6 and onwards
1259
1259
  def test_endlessRange_valid
1260
- assert (0..).valid?
1260
+ assert (0..).valid? # This raises the uncapturable SyntaxError for Ruby 2.5 and before anyway.
1261
1261
  assert (0...).valid?
1262
1262
  refute (true..).valid?
1263
1263
  refute (nil...).valid?
@@ -1559,8 +1559,14 @@ gem "minitest"
1559
1559
 
1560
1560
  # RangeExtd#===
1561
1561
  assert ((?D..?z) === ?c)
1562
- assert !((?a..?z) === "cc")
1563
- assert !((?B..?z) === 'dd')
1562
+
1563
+ if RUBY_VERSION < '2.7'
1564
+ assert !((?a..?z) === "cc")
1565
+ assert !((?B..?z) === 'dd')
1566
+ else
1567
+ assert ((?a..?z) === "cc")
1568
+ assert ((?B..?z) === 'dd')
1569
+ end
1564
1570
 
1565
1571
  # RangeExtd#equiv?
1566
1572
  assert RangeExtd(2...7,true).equiv?(3..6) # => true
@@ -1605,7 +1611,11 @@ gem "minitest"
1605
1611
  assert_equal [3], (1...3.1).last(1)
1606
1612
 
1607
1613
  # RangeExtd#minmax
1608
- assert_equal [0, 3], (0...3.5).minmax
1614
+ if RUBY_VERSION < '2.7'
1615
+ assert_equal [0, 3], (0...3.5).minmax
1616
+ else
1617
+ assert_raises(TypeError){ (0...3.5).minmax } # => TypeError: cannot exclude non Integer end value
1618
+ end
1609
1619
  assert_raises(TypeError){ (1.3...5).minmax } # => TypeError: can't iterate from Float
1610
1620
 
1611
1621
  # RangeExtd#size
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: range_extd
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masa Sakano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-01 00:00:00.000000000 Z
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Package for a subclass of Range, RangeExtd and RangeExtd::Infinity. The
14
14
  former defines a range that enables an exclusion of the begin boundary, in addition
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.0.3
57
+ rubygems_version: 3.1.2
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: RangeExtd - Extended Range class with exclude_begin and open-ends