cw_card_utils 0.1.12 → 0.2.1
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 +4 -4
- data/README.md +38 -1
- data/data/scryfall.cards.cmc.json +396952 -427530
- data/lib/crackling_wit/card_utils.rb +41 -0
- data/lib/crackling_wit.rb +5 -0
- data/lib/cw_card_utils/version.rb +1 -1
- data/lib/cw_card_utils.rb +17 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 906b2d48d1b46bac9ddae4395dde482acda9017854a8f43a88b554421bc34da5
|
|
4
|
+
data.tar.gz: de6f89e9b88dc62552f3ad39253ba40522cfceacf78718aa301c30e71598b25e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4c05be5fede670c4dbaaf06a1813db002366dda8e81ff462452fe8252207f7b790ecf22e86bb93b056304f7680886cceff58a83d90ea6cd0a76791bcc8be6a3
|
|
7
|
+
data.tar.gz: f5da3ba07dc6df50857dada5a27760012d7ecdc344c7be49aafddafcae1564997f1530fab99d018cf3e552d273ba02efa62269a16dfecdecad33cbeb1f1f8d84
|
data/README.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
A Ruby gem for analyzing Magic: The Gathering decklists and calculating various metrics.
|
|
4
4
|
|
|
5
|
+
> Note: A new preferred namespace is available: `CracklingWit::CardUtils`.
|
|
6
|
+
> The legacy `CwCardUtils` namespace remains for backward compatibility and will be softly deprecated.
|
|
7
|
+
>
|
|
8
|
+
> New usage (preferred):
|
|
9
|
+
>
|
|
10
|
+
> ```ruby
|
|
11
|
+
> require "crackling_wit/card_utils"
|
|
12
|
+
> a = CracklingWit::CardUtils::DecklistParser::Parser.new(decklist_a).parse
|
|
13
|
+
> b = CracklingWit::CardUtils::DecklistParser::Parser.new(decklist_b).parse
|
|
14
|
+
> cmp = CracklingWit::CardUtils::DeckComparator.new(a, b)
|
|
15
|
+
> ```
|
|
16
|
+
>
|
|
17
|
+
> Legacy usage (still supported):
|
|
18
|
+
>
|
|
19
|
+
> ```ruby
|
|
20
|
+
> require "cw_card_utils"
|
|
21
|
+
> a = CwCardUtils::DecklistParser::Parser.new(decklist_a).parse
|
|
22
|
+
> ```
|
|
23
|
+
|
|
5
24
|
## Features
|
|
6
25
|
|
|
7
26
|
- Parse decklists (MTGA/MTGO/Moxfield) into a rich `Deck` model
|
|
@@ -65,18 +84,36 @@ cmp = CwCardUtils::DeckComparator.new(a, b)
|
|
|
65
84
|
pp cmp.compare[:on_play] # => win_rate_a, favored, notes, etc.
|
|
66
85
|
```
|
|
67
86
|
|
|
87
|
+
New namespace quickstart:
|
|
88
|
+
|
|
89
|
+
```ruby
|
|
90
|
+
require "crackling_wit/card_utils"
|
|
91
|
+
|
|
92
|
+
a = CracklingWit::CardUtils::DecklistParser::Parser.new(decklist_a).parse
|
|
93
|
+
b = CracklingWit::CardUtils::DecklistParser::Parser.new(decklist_b).parse
|
|
94
|
+
|
|
95
|
+
cmp = CracklingWit::CardUtils::DeckComparator.new(a, b)
|
|
96
|
+
pp cmp.compare[:on_play]
|
|
97
|
+
```
|
|
98
|
+
|
|
68
99
|
## Configuration
|
|
69
100
|
|
|
70
101
|
You can configure the card data source used by the library:
|
|
71
102
|
|
|
72
103
|
```ruby
|
|
73
|
-
#
|
|
104
|
+
# Legacy namespace
|
|
74
105
|
CwCardUtils.configure do |config|
|
|
75
106
|
config.card_data_source = MyCustomDataSource.new
|
|
76
107
|
end
|
|
77
108
|
|
|
109
|
+
# New namespace (delegates to the same config under the hood)
|
|
110
|
+
CracklingWit::CardUtils.configure do |config|
|
|
111
|
+
config.card_data_source = MyCustomDataSource.new
|
|
112
|
+
end
|
|
113
|
+
|
|
78
114
|
# Or set it directly
|
|
79
115
|
CwCardUtils.card_data_source = MyCustomDataSource.new
|
|
116
|
+
CracklingWit::CardUtils.card_data_source = MyCustomDataSource.new
|
|
80
117
|
```
|
|
81
118
|
|
|
82
119
|
The default data source is `CwCardUtils::ScryfallCmcData.instance`, which loads card data from a local JSON file.
|