ofcp_scoring 0.0.5 → 0.1.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
  !binary "U0hBMQ==":
3
- metadata.gz: 1092a3679ad8f85c220160f567d2b9911d769269
4
- data.tar.gz: 70d28ce0eeb101901999f5678126ef282e539714
3
+ metadata.gz: 9305673ffc5d27f574c0d9172ab736bb76917cb8
4
+ data.tar.gz: 7e181a87bf05c500f210ebe9285e52b33f55485f
5
5
  !binary "U0hBNTEy":
6
- metadata.gz: f3d4926b9e0aff65df7c17563249142d8f84b27f55d63e666a8265cdb50de6d17af91fafba4630b87f676a2453f9bb7935436866743569c6c5268681e2a374a0
7
- data.tar.gz: 8c3457838c6bb8bcefbe73776db1f57d6b2722d18575dde66ab2c1f114858509e49dc56811d319b986c8a079106b7a48a8d57e468c28d55ae5e19025d2ab71a9
6
+ metadata.gz: 82a4cb620c5c25170d17fb880d172b9638fea457195775f0654c92855573f9e84e921f1a1b3547f0ee802dae298e1b3e99ef791c7bba46b07a05076081107e38
7
+ data.tar.gz: 1981e86bc71041277715cc2459cc26ccd9f1b0b24fcd32f7cf515e390d56d4c5ccb53a7509aebe8d582afa17e75d9a82a2be492080e735b2591310ebc52a015b
@@ -1,4 +1,6 @@
1
1
  class OfcpScoring::OrganizedHand
2
+ include Enumerable
3
+
2
4
  def initialize(organized_hand)
3
5
  @hand = organized_hand
4
6
  end
@@ -7,6 +9,15 @@ class OfcpScoring::OrganizedHand
7
9
  @hand[:ranks]
8
10
  end
9
11
 
12
+ def sequences
13
+ ranks = @hand[:ranks].reverse
14
+ prev = ranks[0]
15
+ ranks.slice_before { |cur|
16
+ prev, prev2 = cur, prev
17
+ prev2 - 1 != prev
18
+ }.to_a
19
+ end
20
+
10
21
  def suits
11
22
  @hand[:suits]
12
23
  end
@@ -1,3 +1,3 @@
1
1
  module OfcpScoring
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,4 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Organized Hands" do
4
+ it "should be able to find sequences in its ranks" do
5
+ sut = OfcpScoring::OrganizedHand.new({:ranks => [4,5,7,8,9]})
6
+ expect(sut.sequences).to eq([[9,8,7],[5,4]])
7
+ end
4
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ofcp_scoring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clayton Lengel-Zigich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-29 00:00:00.000000000 Z
11
+ date: 2013-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler