italian-ruby 0.4.1 → 0.4.2

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: 5bc920bbf86a7f5609eb4be752e310f75bd5e8ac9b656b20ca9fce2492671301
4
- data.tar.gz: 7a52410a1825e71e09d085db626a7b3f1107272f1e216a7f9945d31b0df16dda
3
+ metadata.gz: 315bfdae9318cce316a19c36d7f40150e01ca6f77f8a306f1dcbf8f765f1af8c
4
+ data.tar.gz: 3f2bcc14489b435c7ed14508137c75d147df51e7d2c360f67e9f695dcb856a44
5
5
  SHA512:
6
- metadata.gz: ca962c06ba35e9674100658c9468023b4a060dfe14d45019ed3aed651d3dbf514987c9fa1fb999341be209c719de1e2f0368fc3e2d63d8d10c8dd79ee6d29fb6
7
- data.tar.gz: 8770913db6f75974bd095d6ce4de55e9bb633527d4cadf1b150bdd58d46f70c82799fc33a6314438361953d3a4c372e6924d6d59f4aef79ca753cdbf22d967d4
6
+ metadata.gz: 1e585308df2c475259efcd34375eb9d9e7008df13aa382df1d6e586345e3167ec425b2515ba51ab8f0212e9713370463029978de816f18cc1a549f2aa2e1771a
7
+ data.tar.gz: cc2d71ff81b5c9ffb85f3f7f4d479205b37005623a36d4e3f7fc7f54ac5db68a8e924b7940723848ea1e7d99c41ae70921a464600446fb7f3c2a1eac4205ef95
@@ -50,9 +50,9 @@ class Array
50
50
  alias :scarta! :reject!
51
51
  alias :trova :find
52
52
  alias :cerniera :zip
53
- alias :in_mappa :to_h
54
53
  alias :ordina :sort
55
54
  alias :ordina_per :sort_by
55
+ alias :raggruppa_per :group_by
56
56
  alias :indice :index
57
57
  alias :indice_da_destra :rindex
58
58
  alias :indice_dal_fondo :rindex
@@ -103,6 +103,23 @@ class Array
103
103
  end
104
104
  end
105
105
  end
106
+
107
+ def mappa_e_rimuovi_duplicati(&block)
108
+ self.map(&block).uniq
109
+ end
110
+
111
+ def in_mappa(&block)
112
+ if block_given?
113
+ self.map(&block).to_h
114
+ else
115
+ self.to_h
116
+ end
117
+ end
118
+
119
+ def secondo
120
+ self[1]
121
+ end
122
+ alias :seconda :secondo
106
123
  end
107
124
 
108
125
  Lista = Array
@@ -7,13 +7,20 @@ require "date"
7
7
 
8
8
  class Date
9
9
  class << self
10
- alias :oggi :today
11
- alias :converti :parse
10
+ alias :oggi :today
11
+ alias :converti :parse
12
12
  end
13
13
 
14
- alias :anno_prossimo :next_year
15
- alias :in_stringa :to_s
16
- alias :in_data :to_date
14
+ alias :anno_prossimo :next_year
15
+ alias :anno_scorso :prev_year
16
+ alias :anno_precedente :prev_year
17
+ alias :in_stringa :to_s
18
+ alias :in_data :to_date
19
+ alias :giorno_della_settimana :cwday
20
+
21
+ def due_anni_fa
22
+ self.prev_year.prev_year
23
+ end
17
24
  end
18
25
 
19
26
  Data = Date
@@ -0,0 +1,18 @@
1
+ ##
2
+ # Core Ext - Range
3
+ #
4
+ # Alias di metodi della classe Range.
5
+
6
+ class Range
7
+ alias :per_ogni :each
8
+ alias :per_ognuno :each
9
+ alias :per_ognuna :each
10
+ alias :mappa :map
11
+ alias :in_lista :to_a
12
+
13
+ def non_include?(*args)
14
+ !include? *args
15
+ end
16
+ end
17
+
18
+ Intervallo = Range
@@ -14,6 +14,7 @@ require_relative "core_ext/nil_class"
14
14
  require_relative "core_ext/json"
15
15
  require_relative "core_ext/object"
16
16
  require_relative "core_ext/array"
17
+ require_relative "core_ext/range"
17
18
  require_relative "core_ext/hash"
18
19
  require_relative "core_ext/string"
19
20
  require_relative "core_ext/symbol"
@@ -1,5 +1,5 @@
1
1
  module Italian
2
2
  module Ruby
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: italian-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Ballardin
@@ -108,6 +108,7 @@ files:
108
108
  - lib/italian/ruby/core_ext/numeric.rb
109
109
  - lib/italian/ruby/core_ext/object.rb
110
110
  - lib/italian/ruby/core_ext/proc.rb
111
+ - lib/italian/ruby/core_ext/range.rb
111
112
  - lib/italian/ruby/core_ext/string.rb
112
113
  - lib/italian/ruby/core_ext/symbol.rb
113
114
  - lib/italian/ruby/core_ext/time.rb