rangeary 0.1.0 → 0.2.0
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 +5 -0
- data/News +4 -0
- data/lib/rangeary/rangeary.rb +19 -0
- data/rangeary.gemspec +4 -3
- data/test/test_rangeary.rb +1 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 723b92f99a375fc95b497d39664ec7850d7eb046
|
4
|
+
data.tar.gz: a6a15abb4bfbab32969bad3d69620006015e9faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c12b17b220eb60c98fa7ddb6b487a43a3a2c9c9c66d0eea27958514c7115fdd36f1d6ffb7349db1015707170d02056590dce00e70c305ff83dbe0f761dca79c9
|
7
|
+
data.tar.gz: b15d01b7d266cbe322b3d08efaa2be826e69d479d6cfcb9bdb33bfbac32504183214b2b65f106ee07d6415499c1999700ca2b129420204d92a166da8bc933dce
|
data/ChangeLog
CHANGED
data/News
CHANGED
data/lib/rangeary/rangeary.rb
CHANGED
@@ -289,6 +289,25 @@ class Rangeary < Array
|
|
289
289
|
alias :end_element :end
|
290
290
|
|
291
291
|
|
292
|
+
# {Range#equiv?} method, defined in range_extd library, extended to this {Rangeary}.
|
293
|
+
#
|
294
|
+
# @example
|
295
|
+
# Rangeary(RangeExtd(1,"<...",4), 5...8).equiv?(Rangeary(2..3, 5..7)) # => true
|
296
|
+
#
|
297
|
+
# @param other [Rangeary]
|
298
|
+
def equiv?(other)
|
299
|
+
return false if size() != other.size
|
300
|
+
|
301
|
+
self.zip(other).each do |ear|
|
302
|
+
if ! ear[0].equiv?(ear[1])
|
303
|
+
return false
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
true
|
308
|
+
end # def equiv?(other)
|
309
|
+
|
310
|
+
|
292
311
|
# Returns the first n elements of the entire range, the same as {Range#first}.
|
293
312
|
#
|
294
313
|
# If the argument is not given, this simply calls {Range#begin} for the first
|
data/rangeary.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rangeary}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2.0"
|
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-05-
|
10
|
+
s.date = %q{2014-05-11}
|
11
11
|
s.summary = %q{Rangeary - class to represent any 1-dimensional multiple-range}
|
12
|
-
s.description = %q{Rangeary is a sub-class of Array and represents any 1-dimensional multiple-range. For example, (x<
|
12
|
+
s.description = %q{Rangeary is a sub-class of Array and represents any 1-dimensional multiple-range. For example, (x<4 and 7<x<=9). All the standard logical operations, such as negation and conjunction, are supported and can be used with conventional Ruby-style operators. Each range is represented as RangeExtd class (Extended Range), which is a sub-class of Range and supports exclude-begin and open-ended (to Infinity) ranges, and is downloadable from https://rubygems.org/gems/range_extd}
|
13
13
|
# s.email = %q{abc@example.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
# "LICENSE",
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/rangeary/rangeary.rb",
|
31
31
|
"test/test_rangeary.rb",
|
32
32
|
]
|
33
|
+
s.add_runtime_dependency 'range_extd', '>= 0.4.0' # Range#equiv? introduced in 0.4.0
|
33
34
|
# s.add_runtime_dependency 'library', '~> 2.2', '>= 2.2.1' # 2.2.1 <= Ver < 2.3.0
|
34
35
|
# s.add_development_dependency "bourne", [">= 0"]
|
35
36
|
# s.homepage = %q{http://}
|
data/test/test_rangeary.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rangeary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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-05-
|
12
|
-
dependencies:
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: range_extd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.0
|
13
27
|
description: Rangeary is a sub-class of Array and represents any 1-dimensional multiple-range. For
|
14
|
-
example, (x<
|
28
|
+
example, (x<4 and 7<x<=9). All the standard logical operations, such as negation
|
15
29
|
and conjunction, are supported and can be used with conventional Ruby-style operators. Each
|
16
30
|
range is represented as RangeExtd class (Extended Range), which is a sub-class of
|
17
31
|
Range and supports exclude-begin and open-ended (to Infinity) ranges, and is downloadable
|