in_italiano 0.0.3 → 0.0.5

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: 76ccd429a768aee90037da68e21200594d37209af466dd3febf719277db1316c
4
- data.tar.gz: ae9d018353e44378bfc4601b120101a3be179e84a02e016677ac2a9567478bea
3
+ metadata.gz: 33f98443c874dcc1f7b57f80fcde96e0501d3924cc3b8dbb0a8a27d179206fff
4
+ data.tar.gz: e11241569ea2b125886607c6f453a6e96c81d84b68da03b8e273be5063d189d1
5
5
  SHA512:
6
- metadata.gz: ddc0555576c8085acecfacce18358e31802f557971fd5b6825dc1c9d4557f7ee3b2f8bcc7f60b5a911971dd88e91e84cf29ee09d7d497dc8ae1d7f247eadeebe
7
- data.tar.gz: 3de27897e1e3aa34d8db8424876cbd9fdc1a1c3dfed6e417899d26846e62e6ec3a7cce7320902f6c8a3b49727c1820ccedfece42f27cb0380a159c4e498aa486
6
+ metadata.gz: 16f5b0b6978c9c4f0b31960994fe844f271421866c9c75557d14edd20bb3575f146c729598755f39245b260bc9ae1302c51825e86521dc92483c3c40f901068b
7
+ data.tar.gz: a052e38d3fe4acf6d01181497d33757e15cff72817ee3613461c21e63d5ca6ae7a28e7940fca5ffe6f788bfd07c71cdf415f276c1b43e4c9df7991f66471d479
@@ -2,18 +2,36 @@ module InItaliano
2
2
  module Classes
3
3
  module String
4
4
  module Patch
5
+ # String Class Documentation:
6
+ # https://docs.ruby-lang.org/en/3.4/String.html
7
+
8
+ # Instance Methods
9
+ def append_as_bytes(*objects)
10
+ ::InItaliano.last_class = :string
11
+ ::InItaliano.last_method = :append_as_bytes
12
+
13
+ super
14
+ end
15
+
16
+ def ascii_only?
17
+ ::InItaliano.last_class = :string
18
+ ::InItaliano.last_method = :ascii_only?
19
+
20
+ super
21
+ end
22
+
5
23
  def capitalize
6
- @@last_class = :string
7
- @@last_method = :capitalize
24
+ ::InItaliano.last_class = :string
25
+ ::InItaliano.last_method = :capitalize
8
26
 
9
27
  super
10
28
  end
11
29
 
12
30
  def method_missing(symbol, *args)
13
31
  if symbol === :in_italiano
14
- translation = TRANSLATIONS[@@last_class][@@last_method]
15
- @@last_class = nil
16
- @@last_method = nil
32
+ translation = TRANSLATIONS[::InItaliano.last_class][::InItaliano.last_method]
33
+ ::InItaliano.last_class = nil
34
+ ::InItaliano.last_method = nil
17
35
  translation
18
36
  else
19
37
  super(symbol, *args)
@@ -0,0 +1,21 @@
1
+ module InItaliano
2
+ module Classes
3
+ module TrueClass
4
+ module Patch
5
+ # True Class Documentation:
6
+ # https://docs.ruby-lang.org/en/3.4/TrueClass.html
7
+
8
+ def method_missing(symbol, *args)
9
+ if symbol === :in_italiano
10
+ translation = TRANSLATIONS[::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
@@ -0,0 +1,13 @@
1
+ module InItaliano
2
+ class History
3
+ attr_accessor :last_class
4
+ attr_accessor :last_method
5
+
6
+ def intialize
7
+ @last_class = nil
8
+ @last_method = nil
9
+ end
10
+ end
11
+
12
+
13
+ end
data/lib/in_italiano.rb CHANGED
@@ -1,16 +1,42 @@
1
+ require 'in_italiano/history'
2
+
1
3
  require 'in_italiano/classes/string/patch'
4
+ require 'in_italiano/classes/true_class/patch'
2
5
 
3
6
  module InItaliano
4
- @@last_class = nil
5
- @@last_method = nil
6
-
7
7
  TRANSLATIONS = {
8
8
  string: {
9
+ append_as_bytes: "aggiungere come byte",
10
+ ascii_only?: "solo ascii?",
9
11
  capitalize: "capitalizzare"
10
12
  }
11
13
  }
14
+
15
+ def self.last_class=(_class)
16
+ @history ||= History.new
17
+ @history.last_class = _class
18
+ end
19
+
20
+ def self.last_class
21
+ @history ||= History.new
22
+ @history.last_class
23
+ end
24
+
25
+ def self.last_method=(_method)
26
+ @history ||= History.new
27
+ @history.last_method = _method
28
+ end
29
+
30
+ def self.last_method
31
+ @history ||= History.new
32
+ @history.last_method
33
+ end
12
34
  end
13
35
 
14
36
  class String
15
37
  prepend InItaliano::Classes::String::Patch
38
+ end
39
+
40
+ class TrueClass
41
+ prepend InItaliano::Classes::TrueClass::Patch
16
42
  end
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.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - dgonzdev
@@ -17,6 +17,8 @@ files:
17
17
  - lib/in_italiano.rb
18
18
  - lib/in_italiano/array_translations.rb
19
19
  - lib/in_italiano/classes/string/patch.rb
20
+ - lib/in_italiano/classes/true_class/patch.rb
21
+ - lib/in_italiano/history.rb
20
22
  homepage: https://rubygems.org/gems/in_italiano
21
23
  licenses: []
22
24
  metadata: {}