cellular_map 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,6 +51,7 @@ module CellularMap
51
51
  # (first to last lines, first to last columns for each line)
52
52
  def each # :yields: cell
53
53
  @y.each { |y| @x.each { |x| yield Cell.new(x, y, @map) } }
54
+ self
54
55
  end
55
56
 
56
57
  # Collecting cells inside the zone.
data/test/test_map.rb CHANGED
@@ -43,6 +43,11 @@ class TestMap < Test::Unit::TestCase
43
43
  assert_equal @map, result
44
44
  }
45
45
 
46
+ should("return itself after iterating") {
47
+ result = @map.each {}
48
+ assert_same @map, result
49
+ }
50
+
46
51
  should("collect all filled cells") {
47
52
  expected = @sample.collect { |c, v| c + [v] }.sort!
48
53
  inside = @map.collect { |cell| [cell.x, cell.y, cell.content] }.sort!
data/test/test_zone.rb CHANGED
@@ -59,6 +59,11 @@ class TestZone < Test::Unit::TestCase
59
59
  assert_equal @positions, inside
60
60
  }
61
61
 
62
+ should("return itself after iterating") {
63
+ result = @zone.each {}
64
+ assert_same @zone, result
65
+ }
66
+
62
67
  should("collect all its cells in a basic one-dimension array") {
63
68
  inside = @zone.collect { |cell| [cell.x, cell.y, cell.content] }.sort!
64
69
  outside = @positions.collect { |x, y| [x, y, @sample[[x, y]]] }.sort!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellular_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Belleville