rangesmaller 1.0.4 → 1.0.5
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 +4 -4
- data/ChangeLog +7 -1
- data/README.rdoc +21 -2
- data/lib/rangesmaller/rangesmaller.rb +9 -9
- data/rangesmaller.gemspec +3 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddeb0f61480335408d9ccf4d9fe5058d8084f4da
|
4
|
+
data.tar.gz: 2d84dde70893d6c18f6ce0f9ba4a79bec3ad9830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7df70aa89ed38c4027507a775279cfea1de7f32be0d8e29edea5326888698763737e733d2a4ed8dcf6ebeccb68178af1cb3210536b1ac224cf567ead48a3b9a
|
7
|
+
data.tar.gz: aff50bbe193b7ed54d4f77e431d8f0a0fdbd7679d493786b573468521815349ab3709f9deec30be2e8dce9c2450810b6e35750e563138fea633f3f471eb98044
|
data/ChangeLog
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
+
-----
|
2
|
+
(Version: v1.0.5)
|
3
|
+
2014-04-29 Masa Saskano
|
4
|
+
* Minor bug fixes and decraring this rangesmaller as obsolete to be superceded with range_extd.
|
5
|
+
|
1
6
|
-----
|
2
7
|
(Version: v1.0.4)
|
3
|
-
2014-04-25 Masa
|
8
|
+
2014-04-25 Masa Sakano
|
9
|
+
|
4
10
|
* The methods ==() and eql?() now calls the method of the same name for each element, like Range and Array.
|
5
11
|
|
6
12
|
-----
|
data/README.rdoc
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
-
= Rangesmaller - Range with exclude_begin
|
1
|
+
= Rangesmaller - Range with exclude_begin (obsolete for Ruby 2)
|
2
2
|
|
3
3
|
This package contains Rangesmaller class, a sub-class of Range and that behaves almost exactly like the super-class Range class, but holds an additional status of whether the boundary of the beginning of the object is included or excluded.
|
4
4
|
|
5
|
+
<b>NOTE: This package is obsolete for Ruby 2.0 and above. Please use
|
6
|
+
range_extd package instead.</b>: {https://rubygems.org/gems/range_extd}
|
7
|
+
|
5
8
|
Rangesmaller objects are immutable, just like Range. Hence once the object is created, it would not change.
|
6
9
|
|
7
10
|
Any (pair of) objects that can consist of Range can be given in initialising, though that does not mean it would always successfully run any methods, like (nil..nil).each().
|
@@ -84,12 +87,28 @@ They are evaluated as follows:
|
|
84
87
|
== Known bugs
|
85
88
|
|
86
89
|
* hash() method does not always guarantee to creat a unique number for the equal Rangesmall object, though such an exception is extremely unlikely to happen.
|
90
|
+
* size() method for Float/Rational has a bug when exclude_begin? is
|
91
|
+
true (which anyway does not work for Ruby 1.8 or earlier, as there
|
92
|
+
is no Range#size implemented up to Ruby 1.8).
|
87
93
|
* No thorough test for Ruby 1.8 or earlier has been done, although there is no known fault.
|
88
94
|
|
95
|
+
<b>NOTE: This package is not supported any more.</b>
|
96
|
+
Please use range_extd package (which does not work in Ruby 1.8 or earlier though) instead:
|
97
|
+
{https://rubygems.org/gems/range_extd}
|
98
|
+
|
99
|
+
{https://rubygems.org/gems/range_extd range_extd} package has the same
|
100
|
+
features as this package, but also supports open-ended (to infinity)
|
101
|
+
ranges. The interface is very similar, though not identical.
|
102
|
+
Many, if not all, codes using Rangesmaller should work with the
|
103
|
+
minimum amount of modification, such as, changing the class name from
|
104
|
+
Rangesmaller to RangeExtd.
|
105
|
+
|
89
106
|
|
90
107
|
== ToDo
|
91
108
|
|
92
|
-
|
109
|
+
* Eventually a warning message will be printed to prompt to upgrade
|
110
|
+
to range_extd package when loaded from Ruby earlier than 2.0.
|
111
|
+
|
93
112
|
|
94
113
|
== Miscellaneous
|
95
114
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#
|
8
8
|
# ==Summary
|
9
9
|
#
|
10
|
-
# Range with inclusion of
|
10
|
+
# Range with inclusion of exclude_begin?().
|
11
11
|
#
|
12
12
|
# Namely, the first element can be tagged as excluded, if specified so.
|
13
13
|
# It behaves the same as Range. Note the method first() (hence each(), size() etc) behaves accordingly, depending whether the smallest boundary is excluded or not (default).
|
@@ -22,7 +22,7 @@
|
|
22
22
|
class Rangesmaller < Range
|
23
23
|
|
24
24
|
# @overload new(rangesmaller)
|
25
|
-
# @param [Rangesmaller] key
|
25
|
+
# @param [Rangesmaller] key
|
26
26
|
#
|
27
27
|
# @overload new(range, opts)
|
28
28
|
# @param range [Range] standard Range object
|
@@ -90,7 +90,7 @@ class Rangesmaller < Range
|
|
90
90
|
@rangepart = r
|
91
91
|
begin
|
92
92
|
if inar[1].has_key?(:exclude_end)
|
93
|
-
if inar[1][:exclude_end]
|
93
|
+
if r.exclude_end? ^ inar[1][:exclude_end]
|
94
94
|
warn "Warning(Rangesmaller.new): Option :exclude_end is given, but is meaningless, as Range is also given."
|
95
95
|
end
|
96
96
|
end
|
@@ -138,7 +138,7 @@ class Rangesmaller < Range
|
|
138
138
|
end # def initialize(*inar)
|
139
139
|
|
140
140
|
|
141
|
-
# Returns
|
141
|
+
# Returns true if the "begin" boundary is excluded, or false otherwise.
|
142
142
|
def exclude_begin?
|
143
143
|
@exclude_begin
|
144
144
|
end
|
@@ -237,7 +237,7 @@ class Rangesmaller < Range
|
|
237
237
|
elsif (defined? self.begin().succ) # Both non-Float
|
238
238
|
Range.new(self.begin().succ, self.end, exclude_end?).send(__method__, *rest, &bloc) # In practice it will not raise an Exception, only when both are Integer.
|
239
239
|
else
|
240
|
-
rangepart.send(__method__, *rest, &bloc) # It will raise an exception anyway! Such as, (Rational..Rational)
|
240
|
+
@rangepart.send(__method__, *rest, &bloc) # It will raise an exception anyway! Such as, (Rational..Rational)
|
241
241
|
end
|
242
242
|
else
|
243
243
|
super
|
@@ -596,10 +596,6 @@ class Range
|
|
596
596
|
end
|
597
597
|
|
598
598
|
|
599
|
-
############## pravate methods of Range ##############
|
600
|
-
|
601
|
-
private
|
602
|
-
|
603
599
|
# Returns true if self is valid as a Range (or Rangesmaller or RangeOpen),
|
604
600
|
# even if it is empty. To construct a valid range, the elements have to
|
605
601
|
# be Comparable, and {#end} is larger than, or equal to, {#begin}.
|
@@ -719,6 +715,10 @@ class Range
|
|
719
715
|
end
|
720
716
|
|
721
717
|
|
718
|
+
############## pravate methods of Range ##############
|
719
|
+
|
720
|
+
private
|
721
|
+
|
722
722
|
# True if obj is Comparable.
|
723
723
|
def is_comparable?(obj)
|
724
724
|
if defined?(obj.<=) # Comparable?
|
data/rangesmaller.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rangesmaller}
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.5"
|
6
6
|
# s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
7
|
# s.executables << 'hola'
|
8
8
|
# s.bindir = 'bin'
|
9
9
|
s.authors = ["Masa Sakano"]
|
10
|
-
s.date = %q{2014-04-
|
10
|
+
s.date = %q{2014-04-29}
|
11
11
|
s.summary = %q{Rangesmaller class -- Range with include_begin?()}
|
12
|
-
s.description = %q{This defines a subclass of Range, Rangesmaller
|
12
|
+
s.description = %q{This defines a subclass of Range, Rangesmaller which has a feature to exclude the begin end. This class is superceded by the range_extd package for Ruby 2.0 and above. See https://rubygems.org/gems/range_extd}
|
13
13
|
# s.email = %q{abc@example.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
# "LICENSE",
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rangesmaller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masa Sakano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: This defines a subclass of Range, Rangesmaller
|
14
|
-
|
15
|
-
|
13
|
+
description: This defines a subclass of Range, Rangesmaller which has a feature to
|
14
|
+
exclude the begin end. This class is superceded by the range_extd package for Ruby
|
15
|
+
2.0 and above. See https://rubygems.org/gems/range_extd
|
16
16
|
email:
|
17
17
|
executables: []
|
18
18
|
extensions: []
|