italian-ruby 0.8.1 → 0.8.7

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: 2fc902d81f7677f9d57ae8ac0a51616ad87058c2cc7f06aafcbbd4e6c613dc9c
4
- data.tar.gz: 3042693afca46a11adff2155ac79a0047cf7b84d89c7db4bd6864c8dcbfab557
3
+ metadata.gz: 83284550d7e3870fcb441f11d5a0ddec4823c6eb230f1416ce9895e246748782
4
+ data.tar.gz: 56b67fa379e306eb12ee16fe129019db57092820f412897191a9047b1dbcee22
5
5
  SHA512:
6
- metadata.gz: 2044c86e8b0fdc7d542b56e88e18fd6fac9d314de9785f868d48e192bfba36b4f113da5ef64c5dd9adedce78574e5029b852cb4cd632e8e00c368bfe41ee45b8
7
- data.tar.gz: 7e3bf9fb1de88a9da2513c51abca9d73c32fb8246af85042ebcdfa9b52befe77306cf266f4f5030ab5612032649e2c78dd266514157dc199b67456139fbc3aff
6
+ metadata.gz: '0852d6a8a169ae6b2421d6c9df88595eca1dbd62588c874d597053541441736b62d798385bdbff233b8f19c49e86584bbe326b6693224864e2babb40e4b5fed1'
7
+ data.tar.gz: d5214dafb0d58cfeb16f6f1927d5ba17796cd932b361ecea13dc18595760eed35437bcf28e6b8b3095833d0dd51348f2e754835c64f418980b7c5d7360bad1e3
@@ -14,6 +14,7 @@ require_relative "core_ext/nil_class"
14
14
  require_relative "core_ext/false_class"
15
15
  require_relative "core_ext/true_class"
16
16
  require_relative "core_ext/json"
17
+ require_relative "core_ext/open_struct"
17
18
  require_relative "core_ext/object"
18
19
  require_relative "core_ext/array"
19
20
  require_relative "core_ext/range"
@@ -69,6 +69,7 @@ class Array
69
69
  alias :rovescia :reverse
70
70
  alias :inverti :reverse
71
71
  alias :lista :entries
72
+ alias :affetta :slice
72
73
 
73
74
  def esiste?
74
75
  !nil? && !empty?
@@ -24,12 +24,20 @@ class Date
24
24
  alias :anno_precedente :prev_year
25
25
  alias :in_stringa :to_s
26
26
  alias :in_data :to_date
27
+ alias :in_tempo :to_time
27
28
  alias :giorno_della_settimana :cwday
29
+ alias :formatta :strftime
28
30
 
29
31
  def due_anni_fa
30
32
  self.prev_year.prev_year
31
33
  end
32
34
  alias :due_anni_precedenti :due_anni_fa
35
+
36
+ alias :original_compare :==
37
+ def ==(other)
38
+ return (self == other.to_date) if other.is_a? Time
39
+ original_compare other
40
+ end
33
41
  end
34
42
 
35
43
  Data = Date
@@ -0,0 +1,21 @@
1
+ require "ostruct"
2
+
3
+ ##
4
+ # Core Ext - OpenStruct
5
+ #
6
+ # Alias di metodi della classe OpenStruct.
7
+
8
+ class OpenStruct
9
+ def in_mappa(*args)
10
+ hash = to_h *args
11
+ hash.in_mappa do |key, value|
12
+ if value.respond_to? :to_h
13
+ [ key, value.to_h ]
14
+ else
15
+ [ key, value ]
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ Archivio = OpenStruct
@@ -43,6 +43,11 @@ class String
43
43
  def non_finisce_con?(*args)
44
44
  !finisce_con? *args
45
45
  end
46
+
47
+ def in_data
48
+ return unless defined? Date
49
+ Date.parse self
50
+ end
46
51
  end
47
52
 
48
53
  Stringa = String
@@ -12,10 +12,21 @@ class Time
12
12
 
13
13
  alias :in_stringa :to_s
14
14
  alias :in_numero :to_i
15
+ alias :formatta :strftime
15
16
 
16
17
  def in_data
17
18
  self.to_date
18
19
  end
20
+
21
+ def in_tempo
22
+ self
23
+ end
24
+
25
+ alias :original_compare :==
26
+ def ==(other)
27
+ return (self.to_date == other) if other.is_a? Date
28
+ original_compare other
29
+ end
19
30
  end
20
31
 
21
32
  Tempo = Time
@@ -1,5 +1,5 @@
1
1
  module Italian
2
2
  module Ruby
3
- VERSION = "0.8.1"
3
+ VERSION = "0.8.7"
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: 0.8.1
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Ballardin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-17 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,6 +95,7 @@ files:
95
95
  - lib/italian/ruby/core_ext/nil_class.rb
96
96
  - lib/italian/ruby/core_ext/numeric.rb
97
97
  - lib/italian/ruby/core_ext/object.rb
98
+ - lib/italian/ruby/core_ext/open_struct.rb
98
99
  - lib/italian/ruby/core_ext/proc.rb
99
100
  - lib/italian/ruby/core_ext/range.rb
100
101
  - lib/italian/ruby/core_ext/string.rb