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: 5c9cd1631b6e99766b32494777c43222d5ca2e4ea0e3061b6df5d509726e4a79
4
- data.tar.gz: 77c4f821c825a9b8ffc65bdb6011f446815f1cd6c0fa106e2531ecf59bc0a355
3
+ metadata.gz: e04b3b680bcea9d302c93c4df7218c8d5d8cd89eb198fd47e0bb50af264568c9
4
+ data.tar.gz: 6fe2685b8054b366735d9c85bb7d79b84685c6be8f8a734310da6be759edc8c8
5
5
  SHA512:
6
- metadata.gz: f88e05c499d4b800b7cf90ca591296ca99b3420cd2075e31c13b8424053b740556f634467674aea5eed18c072b683496c2e4af243428764168cf2dd0592d7c8a
7
- data.tar.gz: 22785ca0c4397232aa65bc18bb9ed30f30341c7ff7161c84ae305d727d23c49ec3acd0ab4ebc074ffcf70d4d2e3ff0cb1ae98e37ca5162554139b03fe869265a
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 :mappa :map
12
- alias :mappa! :map!
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  class Enumerator
4
4
 
5
- alias :mappa :map
5
+ alias :restituisci :map
6
6
  alias :per_ognuno :each
7
7
  alias :per_ognuna :each
8
8
  alias :lista :to_a
@@ -4,7 +4,7 @@ class File
4
4
 
5
5
  class << self
6
6
  alias :espandi :expand_path
7
- alias :nome_file :basename
7
+ alias :nome_base :basename
8
8
  alias :nome_cartella :dirname
9
9
  alias :estensione :extname
10
10
  alias :esiste? :exists?
@@ -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")
@@ -1,5 +1,5 @@
1
1
  module Italian
2
2
  module Ruby
3
- VERSIONE = "1.5.1"
3
+ VERSIONE = "1.5.6"
4
4
  end
5
5
  end
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.1
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: 2021-11-29 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler