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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7c7d46eca2e558f3a179b2d3f8210314ed9ec35
4
- data.tar.gz: c98651d2dd0e8c1cb408a0e9b22ef71597f7888f
3
+ metadata.gz: 723b92f99a375fc95b497d39664ec7850d7eb046
4
+ data.tar.gz: a6a15abb4bfbab32969bad3d69620006015e9faf
5
5
  SHA512:
6
- metadata.gz: d831b7e62d8bc12e3b2e4c824608ec777ba0e730a19c4293455da5d2a5390ed94c2e77ef0640fa260b6599b2268cab3f5caeb8aa968ef11bbd93bbc61ec85a68
7
- data.tar.gz: fba332856a969680c8b9161cd801a0a6f44eff9de5473ae6ba3c61403b4f2189fc822f9d7ae6b936297a113053dee494c2e1f9e811e9c3495b9b05c3e4ff900e
6
+ metadata.gz: c12b17b220eb60c98fa7ddb6b487a43a3a2c9c9c66d0eea27958514c7115fdd36f1d6ffb7349db1015707170d02056590dce00e70c305ff83dbe0f761dca79c9
7
+ data.tar.gz: b15d01b7d266cbe322b3d08efaa2be826e69d479d6cfcb9bdb33bfbac32504183214b2b65f106ee07d6415499c1999700ca2b129420204d92a166da8bc933dce
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ -----
2
+ (Version: 0.2.0)
3
+ 2014-05-11 Masa Saskano
4
+ * New method of Rangeary#equiv?(), with the added dependency on range_extd ">= 0.4.0".
5
+
1
6
  -----
2
7
  (Version: 0.1.0)
3
8
  2014-05-09 Masa Sakano
data/News CHANGED
@@ -1,3 +1,7 @@
1
+ -----
2
+ (Version: 0.2.0) 2014-05-11
3
+ * New method of Rangeary#equiv?(), following the upgraded dependency on range_extd '>= 0.4.0'.
4
+
1
5
  -----
2
6
  (Version: 0.1.0) 2014-05-09
3
7
  * First upload to RubyGems.
@@ -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.1.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-09}
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<3 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}
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://}
@@ -530,6 +530,7 @@ end
530
530
 
531
531
 
532
532
  def test_in_document
533
+ assert Rangeary(RangeExtd(1,"<...",4), 5...8).equiv?(Rangeary(2..3, 5..7)) # => true
533
534
  assert_equal 33, Rangeary(2...4, 5..6, 8..9).flatten.reduce(:+) # => 33
534
535
 
535
536
  r1 = RangeExtd(?a...?d, true) # => a<...d
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.1.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-09 00:00:00.000000000 Z
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<3 and 7<x<=9). All the standard logical operations, such as negation
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