cw_card_utils 0.1.11 → 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 +151 -6
- 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/curve_calculator.rb +50 -0
- data/lib/cw_card_utils/deck_comparator.rb +47 -0
- data/lib/cw_card_utils/decklist_parser/archetype_detector.rb +34 -0
- data/lib/cw_card_utils/decklist_parser/card.rb +67 -2
- data/lib/cw_card_utils/decklist_parser/card_tagger.rb +32 -0
- data/lib/cw_card_utils/decklist_parser/color_identity_resolver.rb +7 -0
- data/lib/cw_card_utils/decklist_parser/deck.rb +177 -1
- data/lib/cw_card_utils/decklist_parser/parser.rb +26 -0
- data/lib/cw_card_utils/scryfall_cmc_data.rb +94 -6
- data/lib/cw_card_utils/synergy_probability.rb +35 -1
- data/lib/cw_card_utils/version.rb +8 -1
- data/lib/cw_card_utils.rb +38 -1
- metadata +4 -1
data/lib/cw_card_utils.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# require_relative "crackling_wit/card_utils"
|
|
4
|
+
|
|
3
5
|
require_relative "cw_card_utils/version"
|
|
4
6
|
require_relative "cw_card_utils/curve_calculator"
|
|
5
7
|
require_relative "cw_card_utils/decklist_parser"
|
|
@@ -7,18 +9,53 @@ require_relative "cw_card_utils/scryfall_cmc_data"
|
|
|
7
9
|
require_relative "cw_card_utils/synergy_probability"
|
|
8
10
|
require_relative "cw_card_utils/deck_comparator"
|
|
9
11
|
|
|
12
|
+
##
|
|
13
|
+
# Public: Top-level namespace for Card Utils.
|
|
14
|
+
# 日本語: Card Utils のトップレベル名前空間です。
|
|
10
15
|
module CwCardUtils
|
|
16
|
+
##
|
|
17
|
+
# Public: Gem-specific error base class.
|
|
18
|
+
# 日本語: このライブラリ用の基本的なエラークラスです。
|
|
11
19
|
class Error < StandardError; end
|
|
12
20
|
|
|
13
|
-
#
|
|
21
|
+
# NOTE: Soft deprecation bridge to the new namespace
|
|
22
|
+
# Users can migrate to `CracklingWit::CardUtils`. All functionality remains.
|
|
23
|
+
module Bridge
|
|
24
|
+
module_function
|
|
25
|
+
|
|
26
|
+
def warn_once
|
|
27
|
+
return if @warned
|
|
28
|
+
@warned = true
|
|
29
|
+
warn("[cw_card_utils] DEPRECATION: Use `CracklingWit::CardUtils` instead of `CwCardUtils`. The old namespace will be removed in a future major release.")
|
|
30
|
+
rescue StandardError
|
|
31
|
+
# no-op in environments where warn is suppressed
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Public: Configuration for the library.
|
|
36
|
+
# 日本語: ライブラリの設定を行います。
|
|
14
37
|
class << self
|
|
38
|
+
# Public: Overrides the global card data source.
|
|
39
|
+
# 日本語: グローバルなカードデータソースを上書きします。
|
|
40
|
+
#
|
|
41
|
+
# @param source [CwCardUtils::CardDataSource]
|
|
15
42
|
attr_writer :card_data_source
|
|
16
43
|
|
|
44
|
+
# Public: Returns the global card data source used by parsers and models.
|
|
45
|
+
# 日本語: パーサやモデルが使用するグローバルなカードデータソースを返します。
|
|
46
|
+
#
|
|
47
|
+
# @return [CwCardUtils::CardDataSource]
|
|
17
48
|
def card_data_source
|
|
18
49
|
@card_data_source ||= ScryfallCmcData.instance
|
|
19
50
|
end
|
|
20
51
|
|
|
52
|
+
# Public: Yields the module for configuration.
|
|
53
|
+
# 日本語: 設定用にモジュール自身をブロックに渡します。
|
|
54
|
+
#
|
|
55
|
+
# @yield [CwCardUtils]
|
|
56
|
+
# @return [void]
|
|
21
57
|
def configure
|
|
58
|
+
Bridge.warn_once
|
|
22
59
|
yield self if block_given?
|
|
23
60
|
end
|
|
24
61
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cw_card_utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Stenhouse
|
|
@@ -36,6 +36,8 @@ files:
|
|
|
36
36
|
- README.md
|
|
37
37
|
- Rakefile
|
|
38
38
|
- data/scryfall.cards.cmc.json
|
|
39
|
+
- lib/crackling_wit.rb
|
|
40
|
+
- lib/crackling_wit/card_utils.rb
|
|
39
41
|
- lib/cw_card_utils.rb
|
|
40
42
|
- lib/cw_card_utils/curve_calculator.rb
|
|
41
43
|
- lib/cw_card_utils/deck_comparator.rb
|
|
@@ -57,6 +59,7 @@ metadata:
|
|
|
57
59
|
homepage_uri: https://cracklingwit.com
|
|
58
60
|
source_code_uri: https://github.com/cracklingwit/card_utils
|
|
59
61
|
changelog_uri: https://github.com/cracklingwit/card_utils/commits/main/
|
|
62
|
+
documentation_uri: https://card-utils.rdoc.cracklingwit.com
|
|
60
63
|
rdoc_options: []
|
|
61
64
|
require_paths:
|
|
62
65
|
- lib
|