board_game_grid 0.1.8 → 0.1.9

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: 65c16ddf332a1bc7229a8b038a6d1716cec9d43bdc875c4e0b139eeb5d987534
4
- data.tar.gz: 1ddd8f91ccf45434eb141f1b26bc6008659555164e7f445e9947986a1bb02d58
3
+ metadata.gz: a4a8a71192d04a29fc52392b43d2cf529345183506d75cba8cf2b48fa19a79e1
4
+ data.tar.gz: b1106c165058b32667a21168498c08026a3cdd39ecd6b2100df2dc20ec01c278
5
5
  SHA512:
6
- metadata.gz: 3af1ea117ae58ad996b9f97b7deca7840ae963eeff28418cccd52b3842db987efe9a1994a0c717cf69096b82bffd179b73a85a5b3f31c3b5a1a1f198b11625cc
7
- data.tar.gz: dd44cb8eef8eedfdff3330035704ed110b713abc7389497f13bda8eba462f829c9196baac108ba1a36707704451cf4f76df084e5813595159fec4582b132e788
6
+ metadata.gz: 2a9dc8424d4fdb0ab80ff86eb8441a8759375a042c48293d8fd03dc647aaf8a2de769feca7824f2800c239fa97d37145558676371af5022adfd9e5dfef978b2d
7
+ data.tar.gz: 01f681727b848101dde180858fff484a06890aa7134b79418d6d94e6a774a6b2d0f5e8f0e3235017473a6252f2b39348929c1d9e3e1dd3a565444a76bbb0b258
@@ -289,6 +289,32 @@ module BoardGameGrid
289
289
  select { |square| Vector.new(origin, square).dx.abs == distance }
290
290
  end
291
291
 
292
+ # Find all squares in the same rank as square
293
+ #
294
+ # @param [Square] square
295
+ # the originating square
296
+ #
297
+ # @return [SquareSet]
298
+ # ==== Example:
299
+ # # Get all squares in the same rank as square_a
300
+ # square_set.same_rank(square_a)
301
+ def same_rank(origin)
302
+ select { |square| square.y == origin.y }
303
+ end
304
+
305
+ # Find all squares in the same file as square
306
+ #
307
+ # @param [Square] square
308
+ # the originating square
309
+ #
310
+ # @return [SquareSet]
311
+ # ==== Example:
312
+ # # Get all squares in the same file as square_a
313
+ # square_set.same_file(square_a)
314
+ def same_file(origin)
315
+ select { |square| square.x == origin.x }
316
+ end
317
+
292
318
  # Find all squares orthogonal from square
293
319
  #
294
320
  # @param [Square] square
@@ -1,3 +1,3 @@
1
1
  module BoardGameGrid
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: board_game_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Humphreys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-16 00:00:00.000000000 Z
11
+ date: 2021-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler