italian-ruby 1.5.1 → 1.5.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e04b3b680bcea9d302c93c4df7218c8d5d8cd89eb198fd47e0bb50af264568c9
|
4
|
+
data.tar.gz: 6fe2685b8054b366735d9c85bb7d79b84685c6be8f8a734310da6be759edc8c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac77f570c2fcc906d1be6a7726f477c5be1740682789bcc8ca6c4a638ea5bb0f42aa95b87667b8825256d21392b5ac9208a0bbdb645c548fa3a12faeced3dde7
|
7
|
+
data.tar.gz: ebcf8ee34557beac8c9fc4cf06626c13bb1beb12cd3ba225d1a6071a743f6affdce68fcba4ccfcad2c094547351c85320747874403d30958713440652366c8ab
|
@@ -7,9 +7,15 @@ class Array
|
|
7
7
|
alias :per_ognuno :each
|
8
8
|
alias :per_ognuna :each
|
9
9
|
alias :in_fette_da :each_slice
|
10
|
+
alias :a_fette_da :each_slice
|
10
11
|
alias :in_gruppi_da :each_slice
|
11
|
-
alias :
|
12
|
-
alias :
|
12
|
+
alias :a_gruppi_da :each_slice
|
13
|
+
alias :in_pacchetti_da :each_slice
|
14
|
+
alias :a_pacchetti_da :each_slice
|
15
|
+
alias :trasforma :map
|
16
|
+
alias :trasforma! :map!
|
17
|
+
alias :restituisci :map
|
18
|
+
alias :restituisci! :map!
|
13
19
|
alias :vuoto? :empty?
|
14
20
|
alias :vuota? :empty?
|
15
21
|
alias :primo :first
|
@@ -14,6 +14,47 @@ class Array
|
|
14
14
|
!include? *args
|
15
15
|
end
|
16
16
|
|
17
|
+
##
|
18
|
+
# Divide la lista in n pacchetti in modo che ogni pacchetto abbia
|
19
|
+
# circa lo stesso numero di elementi.
|
20
|
+
def in_pacchetti_equi da: 25
|
21
|
+
conteggio = self.count
|
22
|
+
|
23
|
+
if conteggio < da
|
24
|
+
avanzamento = da.in_decimale / conteggio
|
25
|
+
indice = 0
|
26
|
+
|
27
|
+
self.each.with_index do |elemento, indice_elemento|
|
28
|
+
pacchetto = [ elemento ]
|
29
|
+
indice += avanzamento
|
30
|
+
indice = da if indice_elemento == conteggio - 1
|
31
|
+
yield pacchetto, indice_elemento, conteggio if block_given?
|
32
|
+
end
|
33
|
+
else
|
34
|
+
avanzamento = conteggio / da.in_decimale
|
35
|
+
elementi_presi = 0
|
36
|
+
contatore = 0
|
37
|
+
indice = 0
|
38
|
+
|
39
|
+
while contatore < da
|
40
|
+
elementi_da_prendere = (indice + avanzamento).round - 1
|
41
|
+
pacchetto = self[elementi_presi..elementi_da_prendere]
|
42
|
+
elementi_presi = elementi_da_prendere + 1
|
43
|
+
indice += avanzamento
|
44
|
+
contatore += 1
|
45
|
+
yield pacchetto, elementi_presi, conteggio if block_given?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
self
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Pacchetti equi da 100.
|
54
|
+
def in_pacchetti_percentuali &blocco
|
55
|
+
in_pacchetti_equi da: 100, &blocco
|
56
|
+
end
|
57
|
+
|
17
58
|
##
|
18
59
|
# Esegue i metodi specificati per ogni elemento della lista.
|
19
60
|
def campiona(*method_names)
|
@@ -46,6 +46,13 @@ class Date
|
|
46
46
|
def formatta_locale(format)
|
47
47
|
formattazione = strftime format
|
48
48
|
formattazione
|
49
|
+
.gsub(/Monday/i, "Lunedì")
|
50
|
+
.gsub(/Tuesday/i, "Martedì")
|
51
|
+
.gsub(/Wednesday/i, "Mercoledì")
|
52
|
+
.gsub(/Thursday/i, "Giovedì")
|
53
|
+
.gsub(/Friday/i, "Venerdì")
|
54
|
+
.gsub(/Saturday/i, "Sabato")
|
55
|
+
.gsub(/Sunday/i, "Domenica")
|
49
56
|
.gsub(/January/i, "Gennaio")
|
50
57
|
.gsub(/February/i, "Febbraio")
|
51
58
|
.gsub(/March/i, "Marzo")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: italian-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Ballardin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|