feen 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 730da5cc06535403835733403b2e86d03435337bd7cd36e5af2d47a1442f199f
4
- data.tar.gz: f3a1b2a952dccbc9bb5eeb15dcfc920d3ea270abb301ed29c098da5260a4c3e4
3
+ metadata.gz: 1a033acfb60b8db7f259e6e787c71c6e9cae62ef3127faeddfec5c881e9a0171
4
+ data.tar.gz: f62cf07a12178a848df661c9a695bc7eb9c8adcac1ea399c252f7c4d9aee77af
5
5
  SHA512:
6
- metadata.gz: c001a2c2c8c7f88aba144ca878c45e11fde53b5c71ff3afa4caf8b05724d4a90dd6addfa32e29a4132b099818b4b6dd1dd0a55ab54b629af48b7113095d6cb54
7
- data.tar.gz: 52f11c59367bc9d7dab6d21ad969cec1f7dd672f7fdab175f577d9076b7443e911b22b63c798198aae176f3939c4142f8eaa4cda1aa775464dbf0ba929f953ae
6
+ metadata.gz: d96c233e0adb0998281b40e8b282526275ace24c53d9200fffd66907617b0b905d34c592ad7f45659d3f8df9dfa64e738c825c2582b6e5d18da443008a2ae348
7
+ data.tar.gz: 443ec302a41d65bc96ca9605edc8d3b2f8fbfd323d042da95a3d783c86f7af301389d8d61f9e1114ec019084d94afe1af8602a70e9b4511ce6a8df177e8f6b82
@@ -2,16 +2,20 @@
2
2
 
3
3
  module FEEN
4
4
  module Dumper
5
- # The pieces in hand class.
6
- #
7
- # @example Serialize a list of pieces in hand grouped by sides
8
- # PiecesInHand.dump(%w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p])
9
- # # => "S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s"
5
+ # The pieces in hand module.
10
6
  module InHand
11
7
  # Serialize pieces in hand lists into a string.
12
8
  #
13
9
  # @param piece_names [Array] A list of pieces in hand.
14
10
  #
11
+ # @example Dump a list of pieces in hand
12
+ # dump(["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"])
13
+ # # => "S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s"
14
+ #
15
+ # @example Dump an empty list of pieces in hand
16
+ # dump([])
17
+ # # => "-"
18
+ #
15
19
  # @return [String] A string representing the pieces in hand.
16
20
  def self.dump(piece_names)
17
21
  return "-" if piece_names.empty?
@@ -12,8 +12,14 @@ module FEEN
12
12
  # parse("S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s")
13
13
  # # => ["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"]
14
14
  #
15
+ # @example Parse an empty list of serialized pieces in hand
16
+ # parse("-")
17
+ # # => []
18
+ #
15
19
  # @return [Array] The list of pieces in hand grouped by players.
16
20
  def self.parse(piece_names_str)
21
+ return [] if piece_names_str == "-"
22
+
17
23
  piece_names_str.split(",")
18
24
  end
19
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feen
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato