i18n_alchemy 0.4.0 → 0.6.0

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: 2b448e3b19d00c30389b8fafe839c2840ba90b264022108c8f9e356e9441f2e3
4
- data.tar.gz: 170fd843fe6f65d8a411c0362121e52ade33ca549a11ec028fb89026bc4216b4
3
+ metadata.gz: a41c87eb8b32e441521a7c95b2f1615953de0bf6577dce86f242bb23a2e19cfe
4
+ data.tar.gz: ff8d7d3523c198fd9eee7943ef3d7511a521d9e67920bbe27fc5b77740384ff5
5
5
  SHA512:
6
- metadata.gz: e3fa185c470cd2ce647f6c22d6e1f296681a940691181b8dda3f47dfdce93a7aaf7a7c9e0d2d7a62c47c38528bfb3b802d15e0dabed1d9d4c9dd8b081537df18
7
- data.tar.gz: 494b9cb4974f6bc8a171c389498e21506be614200a751b097a4a5cf8e2e30d9f14f7b81b4c0931d50596bc3d5ccb750608bc5fb986024a48819c793f0a5f2e0b
6
+ metadata.gz: c5f565332b41135058232b9c6f2209a1f0fb82bd712263eced148a881c8f3adc1c88d13815e79f67178df1ac0104e3f70e4798aa3ff1b0ec09b4566ce38e2ac2
7
+ data.tar.gz: 57e56f3320677ac9f67c8ed6852e11d923c903d4dd38598c8a4b4d6afffc4d6e1a85b1f13eaf4557cdd03dade7c09a2a37d0ee17fbdeca7a085f1e54f79c89dd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## v0.6.0 - 2025-10-17
2
+
3
+ * Drop support for Ruby < 2.7
4
+ * Drop support for Rails < 7.0
5
+ * Rails 8+ support: inherit from `BasicObject` when available, `ActiveSupport::ProxyObject` was deprecated / removed ([#64](https://github.com/carlosantoniodasilva/i18n_alchemy/pull/64))
6
+ * Remove `ruby2_keywords` warning ([#64](https://github.com/carlosantoniodasilva/i18n_alchemy/pull/64))
7
+
8
+ ## v0.5.0 - 2022-01-15
9
+
10
+ * Drop support for Ruby < 2.5
11
+ * Drop support for Rails < 5.2
12
+ * Rails 7 support (no changes required) ([@JonathanFerreira](https://github.com/JonathanFerreira))
13
+ * Ruby 3.1 support (no changes required)
14
+ * Move CI to GitHub Actions
15
+
1
16
  ## v0.4.0 - 2020-03-30
2
17
 
3
18
  * Ruby 3.0 support
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  ## I18nAlchemy
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/i18n_alchemy.svg)](http://badge.fury.io/rb/i18n_alchemy)
4
- [![Build Status](https://api.travis-ci.org/carlosantoniodasilva/i18n_alchemy.svg?branch=master)](http://travis-ci.org/carlosantoniodasilva/i18n_alchemy)
5
- [![Code Climate](https://codeclimate.com/github/carlosantoniodasilva/i18n_alchemy.svg)](https://codeclimate.com/github/carlosantoniodasilva/i18n_alchemy)
6
4
 
7
5
  I18n date/number parsing/localization
8
6
 
@@ -151,7 +149,7 @@ And then just configure the attribute you want to use with this new parser:
151
149
  ```ruby
152
150
  class Product < ActiveRecord::Base
153
151
  include I18n::Alchemy
154
- custom_parsers :released_month => MyCustomDateParser
152
+ localize :released_month, :using => MyCustomDateParser
155
153
  end
156
154
  ```
157
155
 
@@ -1,8 +1,14 @@
1
1
  module I18n
2
2
  module Alchemy
3
3
  # Depend on AS::Basic/ProxyObject which has a "blank slate" - no methods.
4
- base_proxy = defined?(ActiveSupport::ProxyObject) ?
5
- ActiveSupport::ProxyObject : ActiveSupport::BasicObject
4
+ base_proxy =
5
+ if defined?(BasicObject)
6
+ BasicObject
7
+ elsif defined?(ActiveSupport::ProxyObject)
8
+ ActiveSupport::ProxyObject
9
+ else
10
+ ActiveSupport::BasicObject
11
+ end
6
12
 
7
13
  class Proxy < base_proxy
8
14
  include AttributesParsing
@@ -61,7 +67,6 @@ module I18n
61
67
  def method_missing(*args, **kwargs, &block)
62
68
  @target.send(*args, **kwargs, &block)
63
69
  end
64
- ruby2_keywords :method_missing
65
70
  else
66
71
  def method_missing(*args, &block)
67
72
  @target.send(*args, &block)
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Alchemy
3
- VERSION = "0.4.0"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -45,22 +45,9 @@ class ActionViewTest < I18n::Alchemy::TestCase
45
45
  # Since we do not want to rely on Rails dom-assertions (neither from the
46
46
  # framework nor from the extracted gem), we build our own :).
47
47
  def assert_same_text_input(attribute, value)
48
- assert_includes [
49
- text_input_sorted_attributes(attribute, value),
50
- text_input_unsorted_attributes(attribute, value)
51
- ], @template.text_field(:product, attribute, object: @localized)
52
- end
53
-
54
- def text_input_sorted_attributes(attribute_name, value)
55
- size = rails4? ? ' ' : ' size="30" '
56
- %Q[<input id="product_#{attribute_name}" name="product[#{attribute_name}]"#{size}type="text" value="#{value}" />]
57
- end
58
-
59
- def text_input_unsorted_attributes(attribute_name, value)
60
- %Q[<input type="text" value="#{value}" name="product[#{attribute_name}]" id="product_#{attribute_name}" />]
61
- end
62
-
63
- def rails4?
64
- ActionPack::VERSION::STRING.start_with? "4"
48
+ assert_equal(
49
+ %Q[<input type="text" value="#{value}" name="product[#{attribute}]" id="product_#{attribute}" />],
50
+ @template.text_field(:product, attribute, object: @localized)
51
+ )
65
52
  end
66
53
  end
@@ -13,6 +13,22 @@ class ProxyTest < I18n::Alchemy::ProxyTestCase
13
13
  end
14
14
  end
15
15
 
16
+ def test_delegates_method_with_options_to_target_object
17
+ @localized.method_with_options(:argument, option: :option) do |argument, option:|
18
+ assert_equal :argument, argument
19
+ assert_equal :option, option
20
+ end
21
+ end
22
+
23
+ if ::RUBY_VERSION < "3.0"
24
+ def test_delegates_method_with_ruby_pre3_options_to_target_object
25
+ @localized.method_with_options(:argument, { option: :option }) do |argument, option:|
26
+ assert_equal :argument, argument
27
+ assert_equal :option, option
28
+ end
29
+ end
30
+ end
31
+
16
32
  def test_respond_to
17
33
  assert_respond_to @localized, :price
18
34
  assert_respond_to @localized, :price=
@@ -16,6 +16,10 @@ class Product < ActiveRecord::Base
16
16
  yield "called!"
17
17
  end
18
18
 
19
+ def method_with_options(*args, **options)
20
+ yield(*args, **options)
21
+ end
22
+
19
23
  def estimated_last_comission_payment_at
20
24
  (last_sale_at + 5.days).end_of_day if last_sale_at?
21
25
  end
data/test/test_helper.rb CHANGED
@@ -2,18 +2,9 @@ require "rubygems"
2
2
  require "bundler/setup"
3
3
  Bundler.require :test
4
4
 
5
- begin
6
- # Rails 4.1
7
- require 'minitest'
8
- require 'minitest/unit'
9
- Minitest.autorun
10
- MiniTestCase = Minitest::Test
11
- rescue LoadError
12
- # Rails 4.0
13
- require 'minitest/unit'
14
- MiniTest::Unit.autorun
15
- MiniTestCase = MiniTest::Unit::TestCase
16
- end
5
+ require 'minitest'
6
+ require 'minitest/unit'
7
+ Minitest.autorun
17
8
 
18
9
  require "i18n_alchemy"
19
10
  require "action_view"
@@ -31,7 +22,7 @@ Dir["test/custom_parsers/*.rb"].each { |file| require File.expand_path(file) }
31
22
  Dir["test/models/*.rb"].each { |file| require File.expand_path(file) }
32
23
 
33
24
  module I18n::Alchemy
34
- class TestCase < MiniTestCase
25
+ class TestCase < Minitest::Test
35
26
  end
36
27
 
37
28
  class ProxyTestCase < TestCase
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_alchemy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Antonio da Silva
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-03-31 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,20 +15,20 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 4.0.0
18
+ version: 7.0.0
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
- version: '7.0'
21
+ version: '9.0'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: 4.0.0
28
+ version: 7.0.0
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
- version: '7.0'
31
+ version: '9.0'
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: i18n
35
34
  requirement: !ruby/object:Gem::Requirement
@@ -50,40 +49,40 @@ dependencies:
50
49
  requirements:
51
50
  - - ">="
52
51
  - !ruby/object:Gem::Version
53
- version: 4.0.0
52
+ version: 7.0.0
54
53
  - - "<"
55
54
  - !ruby/object:Gem::Version
56
- version: '7.0'
55
+ version: '9.0'
57
56
  type: :development
58
57
  prerelease: false
59
58
  version_requirements: !ruby/object:Gem::Requirement
60
59
  requirements:
61
60
  - - ">="
62
61
  - !ruby/object:Gem::Version
63
- version: 4.0.0
62
+ version: 7.0.0
64
63
  - - "<"
65
64
  - !ruby/object:Gem::Version
66
- version: '7.0'
65
+ version: '9.0'
67
66
  - !ruby/object:Gem::Dependency
68
67
  name: activerecord
69
68
  requirement: !ruby/object:Gem::Requirement
70
69
  requirements:
71
70
  - - ">="
72
71
  - !ruby/object:Gem::Version
73
- version: 4.0.0
72
+ version: 7.0.0
74
73
  - - "<"
75
74
  - !ruby/object:Gem::Version
76
- version: '7.0'
75
+ version: '9.0'
77
76
  type: :development
78
77
  prerelease: false
79
78
  version_requirements: !ruby/object:Gem::Requirement
80
79
  requirements:
81
80
  - - ">="
82
81
  - !ruby/object:Gem::Version
83
- version: 4.0.0
82
+ version: 7.0.0
84
83
  - - "<"
85
84
  - !ruby/object:Gem::Version
86
- version: '7.0'
85
+ version: '9.0'
87
86
  - !ruby/object:Gem::Dependency
88
87
  name: minitest
89
88
  requirement: !ruby/object:Gem::Requirement
@@ -150,9 +149,9 @@ files:
150
149
  - test/models_test.rb
151
150
  - test/test_helper.rb
152
151
  homepage: ''
153
- licenses: []
152
+ licenses:
153
+ - MIT
154
154
  metadata: {}
155
- post_install_message:
156
155
  rdoc_options: []
157
156
  require_paths:
158
157
  - lib
@@ -160,15 +159,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
159
  requirements:
161
160
  - - ">="
162
161
  - !ruby/object:Gem::Version
163
- version: '0'
162
+ version: 2.7.0
164
163
  required_rubygems_version: !ruby/object:Gem::Requirement
165
164
  requirements:
166
165
  - - ">="
167
166
  - !ruby/object:Gem::Version
168
167
  version: '0'
169
168
  requirements: []
170
- rubygems_version: 3.2.3
171
- signing_key:
169
+ rubygems_version: 3.6.9
172
170
  specification_version: 4
173
171
  summary: I18n date/number parsing/localization
174
172
  test_files: