card-mod-collection 0.17.0 → 0.18.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
  SHA256:
3
- metadata.gz: 1cef8e5c341ae3b8bd6fc6724e8ff0572fed9471f7b31d6abe97cf946aebd728
4
- data.tar.gz: 36e2ed5135a0b5db3049aba80c65c96af1e54d31ff57f15c55474d30604c960c
3
+ metadata.gz: 9617cec9ff1447e8c7bb4993c19c97c0fdbb9ca9857ab98b7d1d130ef5ac251d
4
+ data.tar.gz: 126434c4b526190cbef702d034f28acd520dc03a00a8c232cfb825c945b00e60
5
5
  SHA512:
6
- metadata.gz: dc55f9d1d362436e77ef53054cdc1e262e09282c43a7e4cdd36c406a86b14def8170d981080a5643fdea0fdf6041b50ece364294b89caed37d09227ff311e227
7
- data.tar.gz: '086d5ba2abab250c74637bb1a53841561ea6f989dcf56858cd273a1b9a5ae939c1c99ca81a4f124aeef90c5abeeaf84617d95033ff1546c1cd072be6e3928ed3'
6
+ metadata.gz: a4bc81b2fe4236964bebc7f1ce8dbeae11565e3e2615bb630f63a5500cd1fff106eca2ec42aa682d0d8453e93feedb55d9f6d7048d470b1cf769b42b76970ebe
7
+ data.tar.gz: aa3374da17a1de031b844090bfc73c6babd7616f476dc84f3995085abab53fdc72bd38435b42b9f2cdee71957a1401ed6d3c840ea3b30dc4d2d69d5ab530fdd3
@@ -27,7 +27,7 @@ format :html do
27
27
  view :paging, cache: :never, template: :haml
28
28
 
29
29
  def paging_links
30
- PagingLinks.new(total_pages, current_page).build do |text, page, status, options|
30
+ PagingLinks.new(total_pages, current_page).build 5 do |text, page, status, options|
31
31
  page_link_li text, page, status, options
32
32
  end
33
33
  end
data/set/all/item.rb CHANGED
@@ -13,10 +13,12 @@
13
13
  # @option args [String, Integer] :limit max number of cards to return
14
14
  # @option args [String, Integer] :offset begin after the offset-th item
15
15
  def item_names args={}
16
- context = args[:context]
17
- item_strings(args).map do |item|
18
- clean_item_name item, context
19
- end.compact
16
+ seeding_names do
17
+ context = args[:context]
18
+ item_strings(args).map do |item|
19
+ clean_item_name item, context
20
+ end.compact
21
+ end
20
22
  end
21
23
 
22
24
  # @return [Array] list of cards
@@ -178,6 +180,16 @@ end
178
180
 
179
181
  private
180
182
 
183
+ def seeding_names
184
+ yield.tap { |names| Cache.populate_names names }
185
+ end
186
+
187
+ def seeding_ids
188
+ yield.tap do |ids|
189
+ Cache.populate_ids ids if ids.size > 1
190
+ end
191
+ end
192
+
181
193
  def raw_item_strings content
182
194
  content.to_s.split(/\n+/).map { |i| strip_item i }
183
195
  end
@@ -1,3 +1,7 @@
1
+ def unique_items?
2
+ false
3
+ end
4
+
1
5
  # set card content based on array and save card
2
6
  # @param array [Array] list of strings/names (Cardish)
3
7
  def items= array
@@ -13,11 +17,8 @@ end
13
17
 
14
18
  # append item to list (does not save)
15
19
  # @param cardish [String, Card::Name] item name
16
- # @param allow_duplicates [True/False] permit duplicate items (default is False)
17
- def add_item cardish, allow_duplicates=false
18
- return if !allow_duplicates && include_item?(cardish)
19
-
20
- self.content = (item_strings << cardish)
20
+ def add_item cardish
21
+ self.content = item_strings + Array.wrap(cardish)
21
22
  end
22
23
 
23
24
  # append item to list and save card
@@ -70,7 +71,9 @@ def items_content array
70
71
  end
71
72
 
72
73
  def standardized_items array
73
- array.map { |i| standardize_item i }.reject(&:blank?)
74
+ array.map! { |i| standardize_item i }.reject!(&:blank?)
75
+ array.uniq! if unique_items?
76
+ array
74
77
  end
75
78
 
76
79
  def standardize_item item
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-collection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-06-12 00:00:00.000000000 Z
13
+ date: 2024-10-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.107.0
21
+ version: 1.108.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.107.0
28
+ version: 1.108.0
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org
@@ -45,7 +45,7 @@ files:
45
45
  - set/all/recursed.rb
46
46
  homepage: https://decko.org
47
47
  licenses:
48
- - GPL-3.0
48
+ - GPL-3.0-or-later
49
49
  metadata:
50
50
  source_code_uri: https://github.com/decko-commons/decko
51
51
  homepage_uri: https://decko.org
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.5.10
72
+ rubygems_version: 3.5.7
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: collection (list and search)