italian-ruby 1.2.5 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/italian/ruby/alias.rb +1 -0
- data/lib/italian/ruby/alias/array.rb +1 -0
- data/lib/italian/ruby/alias/enumerator.rb +5 -0
- data/lib/italian/ruby/alias/ractor.rb +16 -0
- data/lib/italian/ruby/metodi/date.rb +12 -0
- data/lib/italian/ruby/metodi/kernel.rb +63 -16
- data/lib/italian/ruby/metodi/main.rb +6 -0
- data/lib/italian/ruby/metodi/set.rb +7 -0
- data/lib/italian/ruby/versione.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb58d8626b35d2a70f29c72e1133459caac1ad9ed0b53d34aff28ac024e55423
|
4
|
+
data.tar.gz: 67fd9bfc5cb85f549168633f9d6420853fffd8e57fbedd77c14877e91f93f8ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7337cf9a74ed29e9d5f5fb1e641e0ebcf2eca03ab439753a659ac1f1588a5813c47d39619d058f08778629d4376b8328cd6006ea776e2393c7780df12498df53
|
7
|
+
data.tar.gz: bfae7e1c3f2ca9eb0f166f28c76d9def5449272fbfd9cf383a8041222471212e177b9e54f3da5d8c768d7ebbd3f269ba2fd95f0e9538b42fcb1d3d7266221033
|
data/lib/italian/ruby/alias.rb
CHANGED
@@ -21,6 +21,7 @@ require_relative "alias/object"
|
|
21
21
|
require_relative "alias/open_struct"
|
22
22
|
require_relative "alias/proc"
|
23
23
|
require_relative "alias/process"
|
24
|
+
require_relative "alias/ractor"
|
24
25
|
require_relative "alias/range"
|
25
26
|
require_relative "alias/rational"
|
26
27
|
require_relative "alias/regexp"
|
@@ -25,6 +25,18 @@ class Date
|
|
25
25
|
end
|
26
26
|
|
27
27
|
##
|
28
|
+
# Restituisce la data di inizio anno.
|
29
|
+
def inizio_anno
|
30
|
+
Date.new self.year, 1, 1
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Restituisce la data di fine anno.
|
35
|
+
def fine_anno
|
36
|
+
Date.new self.year, 12, 31
|
37
|
+
end
|
38
|
+
|
39
|
+
|
28
40
|
# Formatta la data secondo la rappresentazione passata.
|
29
41
|
def formatta_locale(format)
|
30
42
|
formattazione = strftime format
|
@@ -38,12 +38,8 @@ module Kernel
|
|
38
38
|
##
|
39
39
|
# Richiede un archivio cercandolo come percorso relativo.
|
40
40
|
def richiedi_relativo(percorso_archivio)
|
41
|
-
sorgente_chiamante
|
42
|
-
|
43
|
-
cartella_chiamante = File.dirname sorgente_chiamante
|
44
|
-
archivio_da_richiedere = File.expand_path File.join(cartella_chiamante, percorso_archivio)
|
45
|
-
archivio_da_richiedere = Dir["#{archivio_da_richiedere}.{ir,rb}"].compact.first
|
46
|
-
|
41
|
+
sorgente_chiamante, linea_chiamante = ottieni_sorgente_e_linea_chiamante caller_locations
|
42
|
+
archivio_da_richiedere = archivio_relativo sorgente_chiamante, percorso_archivio
|
47
43
|
raise LoadError, "cannot load such file -- #{percorso_archivio}" if archivio_da_richiedere.nil?
|
48
44
|
traduci_e_richiedi archivio_da_richiedere
|
49
45
|
rescue LoadError => errore
|
@@ -53,12 +49,8 @@ module Kernel
|
|
53
49
|
##
|
54
50
|
# Richiede tutti gli archivi di una cartella.
|
55
51
|
def richiedi_tutti(percorso_cartella)
|
56
|
-
sorgente_chiamante
|
57
|
-
|
58
|
-
cartella_chiamante = File.dirname sorgente_chiamante
|
59
|
-
cartella_da_richiedere = File.expand_path File.join(cartella_chiamante, percorso_cartella)
|
60
|
-
cartella_da_richiedere = nil unless Dir.exist? cartella_da_richiedere
|
61
|
-
|
52
|
+
sorgente_chiamante, linea_chiamante = ottieni_sorgente_e_linea_chiamante caller_locations
|
53
|
+
cartella_da_richiedere = cartella_relativa sorgente_chiamante, percorso_cartella
|
62
54
|
raise LoadError, "cannot load such directory -- #{percorso_cartella}" if cartella_da_richiedere.nil?
|
63
55
|
Dir["#{cartella_da_richiedere}/**/*.ir"].sort_by { |file| file.count("/") }.each do |archivio|
|
64
56
|
traduci_e_richiedi archivio
|
@@ -67,20 +59,75 @@ module Kernel
|
|
67
59
|
Italian::Ruby::Errori.recupera errore, sorgente_chiamante, linea_chiamante
|
68
60
|
end
|
69
61
|
|
62
|
+
##
|
63
|
+
# Rimanda la costante alla definizione in archivio. La prima volta che viene
|
64
|
+
# incontrata la definizione della costante nel codice, allora l'archivio
|
65
|
+
# verrà richiesto.
|
66
|
+
def rimanda(costante, archivio)
|
67
|
+
archivi_in_memoria = $:.map do |cartella|
|
68
|
+
Dir["#{cartella}/**/#{archivio}.ir"]
|
69
|
+
end
|
70
|
+
archivio_da_tradurre = archivi_in_memoria.flatten.compact.first
|
71
|
+
archivio_da_richiedere = Italian::Ruby.percorso_archivio_tradotto archivio_in_italiano_da_tradurre
|
72
|
+
traduci archivio_da_tradurre
|
73
|
+
Object.autoload costante, archivio_da_richiedere
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Come il rimanda, ma usando un percorso relativo.
|
78
|
+
def rimanda_relativo(costante, percorso_archivio)
|
79
|
+
sorgente_chiamante, linea_chiamante = ottieni_sorgente_e_linea_chiamante caller_locations
|
80
|
+
archivio_da_tradurre = archivio_relativo sorgente_chiamante, percorso_archivio
|
81
|
+
archivio_da_richiedere = Italian::Ruby.percorso_archivio_tradotto archivio_da_tradurre
|
82
|
+
traduci archivio_da_tradurre
|
83
|
+
Object.autoload costante, archivio_da_richiedere
|
84
|
+
end
|
85
|
+
|
70
86
|
private
|
71
87
|
|
88
|
+
##
|
89
|
+
# Traduce un file da ItalianRuby a Ruby.
|
90
|
+
def traduci(archivio)
|
91
|
+
Italian::Ruby::Traduttore.traduci archivio
|
92
|
+
end
|
93
|
+
|
72
94
|
##
|
73
95
|
# Traduce un file da ItalianRuby a Ruby e lo carica in memoria.
|
74
96
|
def traduci_e_carica(archivio)
|
75
|
-
|
76
|
-
load archivio_tradotto
|
97
|
+
load traduci(archivio)
|
77
98
|
end
|
78
99
|
|
79
100
|
##
|
80
101
|
# Traduce un file da ItalianRuby a Ruby e lo richiede.
|
81
102
|
def traduci_e_richiedi(archivio)
|
82
|
-
|
83
|
-
|
103
|
+
require traduci(archivio)
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Ottiene sorgente e linea chiamante.
|
108
|
+
def ottieni_sorgente_e_linea_chiamante(traccia_chiamata)
|
109
|
+
sorgente_chiamante = Italian::Ruby.percorso_archivio_non_tradotto traccia_chiamata.first.absolute_path
|
110
|
+
linea_chiamante = traccia_chiamata.first.lineno
|
111
|
+
|
112
|
+
[ sorgente_chiamante, linea_chiamante ]
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# Ottiene il percorso archivio relativo del sorgente chiamante.
|
117
|
+
def archivio_relativo(sorgente_chiamante, percorso_archivio)
|
118
|
+
cartella_chiamante = File.dirname sorgente_chiamante
|
119
|
+
archivio_da_richiedere = File.expand_path File.join(cartella_chiamante, percorso_archivio)
|
120
|
+
archivio_da_richiedere = Dir["#{archivio_da_richiedere}.{ir,rb}"].compact.first
|
121
|
+
archivio_da_richiedere
|
122
|
+
end
|
123
|
+
|
124
|
+
##
|
125
|
+
# Ottiene il percorso cartella relativo del sorgente chiamante.
|
126
|
+
def cartella_relativa(sorgente_chiamante, percorso_cartella)
|
127
|
+
cartella_chiamante = File.dirname sorgente_chiamante
|
128
|
+
cartella_da_richiedere = File.expand_path File.join(cartella_chiamante, percorso_cartella)
|
129
|
+
cartella_da_richiedere = nil unless Dir.exist? cartella_da_richiedere
|
130
|
+
cartella_da_richiedere
|
84
131
|
end
|
85
132
|
|
86
133
|
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.2
|
4
|
+
version: 1.3.2
|
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
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/italian/ruby/alias/open_struct.rb
|
99
99
|
- lib/italian/ruby/alias/proc.rb
|
100
100
|
- lib/italian/ruby/alias/process.rb
|
101
|
+
- lib/italian/ruby/alias/ractor.rb
|
101
102
|
- lib/italian/ruby/alias/range.rb
|
102
103
|
- lib/italian/ruby/alias/rational.rb
|
103
104
|
- lib/italian/ruby/alias/regexp.rb
|