in_italiano 0.0.7 → 0.0.9

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: 7162825f59115a2179b49ff3c0388112148d14d73be5573aae89380fc0ef553b
4
- data.tar.gz: 964d92db612b411a576c606ff9fc4b71d75ed8f38314d3400bf41cd8e87b9db1
3
+ metadata.gz: cbbde6d93980828e329b378dfc2b1e7761cb56dc556df43b781ba222fe864132
4
+ data.tar.gz: fbb725c9700100804071ebfc075585079c12330ce8a0f1d9e644579cee8b92c6
5
5
  SHA512:
6
- metadata.gz: be4ff49a7e3d35c1b8615cf5b8ef80f5d81f8b6864e81ed805534e4fe8e7ad948e0548e77d17e327c58d81b9fbc4817ef6fd2c30768da219f65fce7f575832b8
7
- data.tar.gz: eeca95a144e1426b9c018ebc08691268a8e371486388ffe1934cf85f2de5a81df84d1df8ea63a26324ec19188cefa0da6a8f90216d8fc705aa99d5462196e477
6
+ metadata.gz: 42d2a87e88b1d772c51a27b9e5ae198710fab00d00c58f927978cc628a72c0d81694eaf1b40c9a81d2618254113203b674c765e96f97f3eb36ba701ab0854753
7
+ data.tar.gz: 7f8cf56e420209a37b980b1eab5e03c59898106b145759a46d8d310a548367e5b5b19560a750f2fa2685a8b71fbe8b3efd1a5a1511a6ec8c7f9a5df325086299
@@ -7,7 +7,7 @@ module InItaliano
7
7
 
8
8
  def method_missing(symbol, *args)
9
9
  if symbol === :in_italiano
10
- translation = TRANSLATIONS[::InItaliano.last_class][::InItaliano.last_method]
10
+ translation = Translations.find(::InItaliano.last_class, ::InItaliano.last_method)
11
11
  ::InItaliano.last_class = nil
12
12
  ::InItaliano.last_method = nil
13
13
  translation
@@ -0,0 +1,21 @@
1
+ module InItaliano
2
+ module Classes
3
+ module Integer
4
+ module Patch
5
+ # Integer Class Documentation:
6
+ # https://docs.ruby-lang.org/en/3.4/Integer.html
7
+
8
+ def method_missing(symbol, *args)
9
+ if symbol === :in_italiano
10
+ translation = Translations.find(::InItaliano.last_class, ::InItaliano.last_method)
11
+ ::InItaliano.last_class = nil
12
+ ::InItaliano.last_method = nil
13
+ translation
14
+ else
15
+ super(symbol, *args)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -10,7 +10,7 @@ module InItaliano
10
10
  return "Cordicella"
11
11
  end
12
12
 
13
- TRANSLATIONS[:string][method_name]
13
+ Translations.find(:string, method_name)
14
14
  end
15
15
  end
16
16
  end
@@ -20,6 +20,20 @@ module InItaliano
20
20
  super
21
21
  end
22
22
 
23
+ def b
24
+ ::InItaliano.last_class = :string
25
+ ::InItaliano.last_method = :b
26
+
27
+ super
28
+ end
29
+
30
+ def byteindex(substring, offset = 0)
31
+ ::InItaliano.last_class = :string
32
+ ::InItaliano.last_method = :byteindex
33
+
34
+ super
35
+ end
36
+
23
37
  def bytes
24
38
  ::InItaliano.last_class = :string
25
39
  ::InItaliano.last_method = :bytes
@@ -36,7 +50,7 @@ module InItaliano
36
50
 
37
51
  def method_missing(symbol, *args)
38
52
  if symbol === :in_italiano
39
- translation = TRANSLATIONS[::InItaliano.last_class][::InItaliano.last_method]
53
+ translation = Translations.find(::InItaliano.last_class, ::InItaliano.last_method)
40
54
  ::InItaliano.last_class = nil
41
55
  ::InItaliano.last_method = nil
42
56
  translation
@@ -7,7 +7,7 @@ module InItaliano
7
7
 
8
8
  def method_missing(symbol, *args)
9
9
  if symbol === :in_italiano
10
- translation = TRANSLATIONS[::InItaliano.last_class][::InItaliano.last_method]
10
+ translation = Translations.find(::InItaliano.last_class, ::InItaliano.last_method)
11
11
  ::InItaliano.last_class = nil
12
12
  ::InItaliano.last_method = nil
13
13
  translation
@@ -0,0 +1,18 @@
1
+ module InItaliano
2
+ class Translations
3
+ STRING = {
4
+ append_as_bytes: "aggiungere come byte",
5
+ ascii_only?: "solo ascii?",
6
+ b: "b",
7
+ byteindex: "indice dei byte",
8
+ bytes: "i byte",
9
+ capitalize: "capitalizzare"
10
+ }
11
+
12
+ def self.find(class_name, method_name)
13
+ if class_name == :string
14
+ STRING[method_name]
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/in_italiano.rb CHANGED
@@ -1,20 +1,7 @@
1
1
  require 'in_italiano/history'
2
-
3
- require 'in_italiano/classes/array/patch'
4
- require 'in_italiano/classes/string/patch'
5
- require 'in_italiano/classes/string/class_methods_patch'
6
- require 'in_italiano/classes/true_class/patch'
2
+ require 'in_italiano/translations'
7
3
 
8
4
  module InItaliano
9
- TRANSLATIONS = {
10
- string: {
11
- append_as_bytes: "aggiungere come byte",
12
- ascii_only?: "solo ascii?",
13
- bytes: "i byte",
14
- capitalize: "capitalizzare"
15
- }
16
- }
17
-
18
5
  def self.last_class=(_class)
19
6
  @history ||= History.new
20
7
  @history.last_class = _class
@@ -36,10 +23,20 @@ module InItaliano
36
23
  end
37
24
  end
38
25
 
26
+ require 'in_italiano/classes/array/patch'
27
+ require 'in_italiano/classes/integer/patch'
28
+ require 'in_italiano/classes/string/class_methods_patch'
29
+ require 'in_italiano/classes/string/patch'
30
+ require 'in_italiano/classes/true_class/patch'
31
+
39
32
  class Array
40
33
  prepend InItaliano::Classes::Array::Patch
41
34
  end
42
35
 
36
+ class Integer
37
+ prepend InItaliano::Classes::Integer::Patch
38
+ end
39
+
43
40
  class String
44
41
  extend InItaliano::Classes::String::ClassMethodsPatch
45
42
  prepend InItaliano::Classes::String::Patch
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: in_italiano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - dgonzdev
@@ -16,10 +16,12 @@ extra_rdoc_files: []
16
16
  files:
17
17
  - lib/in_italiano.rb
18
18
  - lib/in_italiano/classes/array/patch.rb
19
+ - lib/in_italiano/classes/integer/patch.rb
19
20
  - lib/in_italiano/classes/string/class_methods_patch.rb
20
21
  - lib/in_italiano/classes/string/patch.rb
21
22
  - lib/in_italiano/classes/true_class/patch.rb
22
23
  - lib/in_italiano/history.rb
24
+ - lib/in_italiano/translations.rb
23
25
  homepage: https://rubygems.org/gems/in_italiano
24
26
  licenses: []
25
27
  metadata: {}