Naposledy aktivní 1737377552

demo revidoval tento gist 1737377552. Přejít na revizi

1 file changed, 19 insertions, 17 deletions

hello.rb

@@ -1,17 +1,19 @@
1 - # Make an array of hashes contain a unique value for key:
2 - def uniquify_array(array, key)
3 - array.group_by { |item| item[key] }.map do |_, items|
4 - (items.length > 1) ? yield(items) : items.first
5 - end
6 - end
7 -
8 -
9 - # new_array = uniquify_array(array, :some_key) do |dupes|
10 - # dupes.max_by { |item| item[:updated_at] }
11 - # end
12 -
13 - # @PICOPACKAGE_START
14 - # source_url: https://demo.opengist.io/demo/055d22e580e24e3797bca862cefbea7e
15 - # filename: uniquify_array.rb
16 - # version: 0.2
17 - # @PICOPACKAGE_END
1 + # Make an array of hashes contain a unique value for key:
2 + def uniquify_array(array, key)
3 + array.group_by { |item| item[key] }.map do |_, items|
4 + (items.length > 1) ? yield(items) : items.first
5 + end
6 + end
7 +
8 +
9 + # new_array = uniquify_array(array, :some_key) do |dupes|
10 + # dupes.max_by { |item| item[:updated_at] }
11 + # end
12 +
13 + # @PICOPACKAGE_START
14 + # ---
15 + # source_url: https://demo.opengist.io/demo/055d22e580e24e3797bca862cefbea7e
16 + # filename: uniquify_array.rb
17 + # version: 0.1
18 + # content_checksum: sha256:806744e83b59e741f0c6e7f342a7d188e4af04cd44145fe2381c511e49b67b63
19 + # @PICOPACKAGE_END

demo revidoval tento gist 1737377402. Přejít na revizi

1 file changed, 1 insertion, 1 deletion

hello.rb

@@ -13,5 +13,5 @@ end
13 13 # @PICOPACKAGE_START
14 14 # source_url: https://demo.opengist.io/demo/055d22e580e24e3797bca862cefbea7e
15 15 # filename: uniquify_array.rb
16 - # version: 0.1
16 + # version: 0.2
17 17 # @PICOPACKAGE_END

demo revidoval tento gist 1737373390. Přejít na revizi

1 file changed, 7 insertions, 7 deletions

hello.rb

@@ -1,9 +1,3 @@
1 - # @META_START
2 - # source_url: https://demo.opengist.io/demo/055d22e580e24e3797bca862cefbea7e
3 - # filename: uniquify_array.rb
4 - # version: 0.1
5 - # @META_END
6 -
7 1 # Make an array of hashes contain a unique value for key:
8 2 def uniquify_array(array, key)
9 3 array.group_by { |item| item[key] }.map do |_, items|
@@ -14,4 +8,10 @@ end
14 8
15 9 # new_array = uniquify_array(array, :some_key) do |dupes|
16 10 # dupes.max_by { |item| item[:updated_at] }
17 - # end
11 + # end
12 +
13 + # @PICOPACKAGE_START
14 + # source_url: https://demo.opengist.io/demo/055d22e580e24e3797bca862cefbea7e
15 + # filename: uniquify_array.rb
16 + # version: 0.1
17 + # @PICOPACKAGE_END

demo revidoval tento gist 1737251108. Přejít na revizi

1 file changed, 1 insertion, 1 deletion

hello.rb

@@ -1,5 +1,5 @@
1 1 # @META_START
2 - # source_url: https://
2 + # source_url: https://demo.opengist.io/demo/055d22e580e24e3797bca862cefbea7e
3 3 # filename: uniquify_array.rb
4 4 # version: 0.1
5 5 # @META_END

demo revidoval tento gist 1737251097. Přejít na revizi

1 file changed, 17 insertions

hello.rb(vytvořil soubor)

@@ -0,0 +1,17 @@
1 + # @META_START
2 + # source_url: https://
3 + # filename: uniquify_array.rb
4 + # version: 0.1
5 + # @META_END
6 +
7 + # Make an array of hashes contain a unique value for key:
8 + def uniquify_array(array, key)
9 + array.group_by { |item| item[key] }.map do |_, items|
10 + (items.length > 1) ? yield(items) : items.first
11 + end
12 + end
13 +
14 +
15 + # new_array = uniquify_array(array, :some_key) do |dupes|
16 + # dupes.max_by { |item| item[:updated_at] }
17 + # end
Novější Starší