cards_lib 0.0.6 → 0.0.7

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
  SHA1:
3
- metadata.gz: c0852ab0d0d53bc0e53dae11134b73666e3ab6f6
4
- data.tar.gz: bda57195826ca5c1aa4beaae728ea5172aab6714
3
+ metadata.gz: 442a10e3d31214eca9c029e3d067be0311b6ce37
4
+ data.tar.gz: a889ec91bac19719a9db03a9558f2c0f5f39d476
5
5
  SHA512:
6
- metadata.gz: 68f6a9ae594cbbc6cd79b0654c093d5633bf6821f9065fcd19f7367652a23e7d93f71e8865af63513c3782110f83e73b7e8aaaa11916c72ebe8804bcd2e2a1d2
7
- data.tar.gz: 535e112f704b2b7910f40492c933dd6a46e996ab5d9cf766b97015fe903f2976c908350a18638c0c28f33052f2cfc20ead0b5e7f629a4e1f4bc961736a9db512
6
+ metadata.gz: 2007bac8b61324b40e0d6b9dc5f23e162a4fac3e1855cfdbabcbedc3d954fa5fc3aa11886af5575a6b316f51ebf7e8503a6089f7735e14f0b17e202258d4f72d
7
+ data.tar.gz: 1514cd6263e2b984a46b4e861de1ad3448bb4a107f1af7a07100ca83dcfcd3f0a5cc61e61ef771e0cbb815313e23058575d4b8c029a434db7d777544ea8fb425
data/.idea/workspace.xml CHANGED
@@ -2,11 +2,7 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="8e729df1-4f81-4614-900c-5868119b304d" name="Default" comment="">
5
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/cards_lib/ranker.rb" />
6
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/cards_lib/card.rb" afterPath="$PROJECT_DIR$/lib/cards_lib/card.rb" />
7
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/card_test.rb" afterPath="$PROJECT_DIR$/test/card_test.rb" />
8
5
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/cards_lib/version.rb" afterPath="$PROJECT_DIR$/lib/cards_lib/version.rb" />
9
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
10
6
  </list>
11
7
  <ignored path="CardsLib.iws" />
12
8
  <ignored path=".idea/workspace.xml" />
@@ -27,31 +23,51 @@
27
23
  </component>
28
24
  <component name="FileEditorManager">
29
25
  <leaf>
30
- <file leaf-file-name="card_test.rb" pinned="false" current-in-tab="true">
26
+ <file leaf-file-name="card_test.rb" pinned="false" current-in-tab="false">
31
27
  <entry file="file://$PROJECT_DIR$/test/card_test.rb">
32
28
  <provider selected="true" editor-type-id="text-editor">
33
- <state vertical-scroll-proportion="1.0378913">
34
- <caret line="42" column="5" selection-start-line="42" selection-start-column="5" selection-end-line="42" selection-end-column="5" />
29
+ <state vertical-scroll-proportion="0.0">
30
+ <caret line="57" column="67" selection-start-line="57" selection-start-column="67" selection-end-line="57" selection-end-column="67" />
35
31
  <folding />
36
32
  </state>
37
33
  </provider>
38
34
  </entry>
39
35
  </file>
40
- <file leaf-file-name="card.rb" pinned="false" current-in-tab="false">
41
- <entry file="file://$PROJECT_DIR$/lib/cards_lib/card.rb">
36
+ <file leaf-file-name="ranker.rb" pinned="false" current-in-tab="false">
37
+ <entry file="file://$PROJECT_DIR$/lib/cards_lib/ranker.rb">
42
38
  <provider selected="true" editor-type-id="text-editor">
43
39
  <state vertical-scroll-proportion="0.0">
44
- <caret line="2" column="19" selection-start-line="2" selection-start-column="19" selection-end-line="2" selection-end-column="19" />
40
+ <caret line="25" column="7" selection-start-line="25" selection-start-column="7" selection-end-line="25" selection-end-column="7" />
45
41
  <folding />
46
42
  </state>
47
43
  </provider>
48
44
  </entry>
49
45
  </file>
50
- <file leaf-file-name="ranker.rb" pinned="false" current-in-tab="false">
51
- <entry file="file://$PROJECT_DIR$/lib/cards_lib/ranker.rb">
46
+ <file leaf-file-name="version.rb" pinned="false" current-in-tab="true">
47
+ <entry file="file://$PROJECT_DIR$/lib/cards_lib/version.rb">
48
+ <provider selected="true" editor-type-id="text-editor">
49
+ <state vertical-scroll-proportion="0.024711696">
50
+ <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
51
+ <folding />
52
+ </state>
53
+ </provider>
54
+ </entry>
55
+ </file>
56
+ <file leaf-file-name="cards_lib.rb" pinned="false" current-in-tab="false">
57
+ <entry file="file://$PROJECT_DIR$/lib/cards_lib.rb">
52
58
  <provider selected="true" editor-type-id="text-editor">
53
59
  <state vertical-scroll-proportion="0.0">
54
- <caret line="21" column="7" selection-start-line="21" selection-start-column="7" selection-end-line="21" selection-end-column="7" />
60
+ <caret line="4" column="25" selection-start-line="4" selection-start-column="25" selection-end-line="4" selection-end-column="25" />
61
+ <folding />
62
+ </state>
63
+ </provider>
64
+ </entry>
65
+ </file>
66
+ <file leaf-file-name="card.rb" pinned="false" current-in-tab="false">
67
+ <entry file="file://$PROJECT_DIR$/lib/cards_lib/card.rb">
68
+ <provider selected="true" editor-type-id="text-editor">
69
+ <state vertical-scroll-proportion="0.0">
70
+ <caret line="47" column="5" selection-start-line="47" selection-start-column="5" selection-end-line="47" selection-end-column="5" />
55
71
  <folding />
56
72
  </state>
57
73
  </provider>
@@ -66,11 +82,12 @@
66
82
  <option name="CHANGED_PATHS">
67
83
  <list>
68
84
  <option value="$PROJECT_DIR$/.gitignore" />
69
- <option value="$PROJECT_DIR$/lib/cards_lib/version.rb" />
70
- <option value="$PROJECT_DIR$/lib/cards_lib/ranker.rb" />
71
85
  <option value="$PROJECT_DIR$/lib/cards_lib/standard.rb" />
72
- <option value="$PROJECT_DIR$/test/card_test.rb" />
86
+ <option value="$PROJECT_DIR$/lib/cards_lib/ranker.rb" />
73
87
  <option value="$PROJECT_DIR$/lib/cards_lib/card.rb" />
88
+ <option value="$PROJECT_DIR$/lib/cards_lib.rb" />
89
+ <option value="$PROJECT_DIR$/test/card_test.rb" />
90
+ <option value="$PROJECT_DIR$/lib/cards_lib/version.rb" />
74
91
  </list>
75
92
  </option>
76
93
  </component>
@@ -110,7 +127,6 @@
110
127
  <sortByType />
111
128
  </navigator>
112
129
  <panes>
113
- <pane id="Scratches" />
114
130
  <pane id="ProjectPane">
115
131
  <subPane>
116
132
  <PATH>
@@ -177,6 +193,7 @@
177
193
  </PATH>
178
194
  </subPane>
179
195
  </pane>
196
+ <pane id="Scratches" />
180
197
  <pane id="Scope" />
181
198
  </panes>
182
199
  </component>
@@ -305,6 +322,12 @@
305
322
  <method />
306
323
  </configuration>
307
324
  <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
325
+ <node-options />
326
+ <gulpfile />
327
+ <tasks />
328
+ <arguments />
329
+ <pass-parent-envs>true</pass-parent-envs>
330
+ <envs />
308
331
  <method />
309
332
  </configuration>
310
333
  </component>
@@ -323,16 +346,14 @@
323
346
  </component>
324
347
  <component name="ToolWindowManager">
325
348
  <frame x="50" y="21" width="1230" height="1003" extended-state="6" />
326
- <editor active="false" />
349
+ <editor active="true" />
327
350
  <layout>
328
- <window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32908705" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
351
+ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32908705" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
329
352
  <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
330
353
  <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
331
354
  <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
332
355
  <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
333
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25841752" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
334
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
335
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
356
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.26262626" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
336
357
  <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
337
358
  <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
338
359
  <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
@@ -340,9 +361,11 @@
340
361
  <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
341
362
  <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
342
363
  <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
364
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
343
365
  <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
344
366
  <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
345
367
  <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
368
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
346
369
  </layout>
347
370
  </component>
348
371
  <component name="Vcs.Log.UiProperties">
@@ -433,14 +456,6 @@
433
456
  </state>
434
457
  </provider>
435
458
  </entry>
436
- <entry file="file://$PROJECT_DIR$/lib/cards_lib/version.rb">
437
- <provider selected="true" editor-type-id="text-editor">
438
- <state vertical-scroll-proportion="0.024711696">
439
- <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
440
- <folding />
441
- </state>
442
- </provider>
443
- </entry>
444
459
  <entry file="file://$PROJECT_DIR$/lib/cards_lib/standard.rb">
445
460
  <provider selected="true" editor-type-id="text-editor">
446
461
  <state vertical-scroll-proportion="0.049423393">
@@ -460,7 +475,15 @@
460
475
  <entry file="file://$PROJECT_DIR$/lib/cards_lib/ranker.rb">
461
476
  <provider selected="true" editor-type-id="text-editor">
462
477
  <state vertical-scroll-proportion="0.0">
463
- <caret line="21" column="7" selection-start-line="21" selection-start-column="7" selection-end-line="21" selection-end-column="7" />
478
+ <caret line="25" column="7" selection-start-line="25" selection-start-column="7" selection-end-line="25" selection-end-column="7" />
479
+ <folding />
480
+ </state>
481
+ </provider>
482
+ </entry>
483
+ <entry file="file://$PROJECT_DIR$/lib/cards_lib.rb">
484
+ <provider selected="true" editor-type-id="text-editor">
485
+ <state vertical-scroll-proportion="0.0">
486
+ <caret line="4" column="25" selection-start-line="4" selection-start-column="25" selection-end-line="4" selection-end-column="25" />
464
487
  <folding />
465
488
  </state>
466
489
  </provider>
@@ -468,15 +491,23 @@
468
491
  <entry file="file://$PROJECT_DIR$/lib/cards_lib/card.rb">
469
492
  <provider selected="true" editor-type-id="text-editor">
470
493
  <state vertical-scroll-proportion="0.0">
471
- <caret line="2" column="19" selection-start-line="2" selection-start-column="19" selection-end-line="2" selection-end-column="19" />
494
+ <caret line="47" column="5" selection-start-line="47" selection-start-column="5" selection-end-line="47" selection-end-column="5" />
472
495
  <folding />
473
496
  </state>
474
497
  </provider>
475
498
  </entry>
476
499
  <entry file="file://$PROJECT_DIR$/test/card_test.rb">
477
500
  <provider selected="true" editor-type-id="text-editor">
478
- <state vertical-scroll-proportion="1.0378913">
479
- <caret line="42" column="5" selection-start-line="42" selection-start-column="5" selection-end-line="42" selection-end-column="5" />
501
+ <state vertical-scroll-proportion="0.0">
502
+ <caret line="57" column="67" selection-start-line="57" selection-start-column="67" selection-end-line="57" selection-end-column="67" />
503
+ <folding />
504
+ </state>
505
+ </provider>
506
+ </entry>
507
+ <entry file="file://$PROJECT_DIR$/lib/cards_lib/version.rb">
508
+ <provider selected="true" editor-type-id="text-editor">
509
+ <state vertical-scroll-proportion="0.024711696">
510
+ <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
480
511
  <folding />
481
512
  </state>
482
513
  </provider>
@@ -37,34 +37,13 @@ module CardsLib
37
37
  def <=>(other)
38
38
  @ranker.<=>(other)
39
39
  end
40
- end
41
-
42
- class InvalidCardFace < Exception
43
-
44
- end
45
40
 
46
- class Ranker
47
- include Comparable
48
- attr :rank, :ranks, :rank_lookup
49
- def initialize(
50
- rank = nil,
51
- ranks: "A23456789TJQK".split(''),
52
- rank_lookup: ->rank_face{
53
- r = @ranks.index(rank_face).to_i + 1
54
- # r = 10 if r > 10
55
- r
56
- })
57
- @rank = rank
58
- @ranks = ranks
59
- @rank_lookup = rank_lookup
41
+ def sequential(other)
42
+ @ranker.sequential(other)
60
43
  end
44
+ end
61
45
 
62
- def <=>(item)
63
- @rank_lookup[self.rank] <=> @rank_lookup[item.rank]
64
- end
46
+ class InvalidCardFace < Exception
65
47
 
66
- def inspect
67
- @rank
68
- end
69
48
  end
70
49
  end
@@ -20,5 +20,9 @@ module CardsLib
20
20
  def inspect
21
21
  @rank
22
22
  end
23
+
24
+ def sequential(item)
25
+ (@rank_lookup[self.rank] - @rank_lookup[item.rank]).abs == 1
26
+ end
23
27
  end
24
28
  end
@@ -1,3 +1,3 @@
1
1
  module CardsLib
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/cards_lib.rb CHANGED
@@ -2,6 +2,7 @@ require "cards_lib/version"
2
2
  require "cards_lib/card"
3
3
  require "cards_lib/deck"
4
4
  require "cards_lib/standard"
5
+ require "cards_lib/ranker"
5
6
 
6
7
  module CardsLib
7
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cards_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel P. Clark