it 1.0.0 → 2.0.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
- SHA1:
3
- metadata.gz: 3afe5b083028e03d2498a736e5a7755b8729e5ed
4
- data.tar.gz: 4f787ab01e824e5cf59864aa1b8ca7f9e4483a24
2
+ SHA256:
3
+ metadata.gz: 4b79069211ccb670779e106ffa6802ab17feac3d72ca87b4088ce4eab9b928b7
4
+ data.tar.gz: 61b097f8a810653820c8376c523b56f5a7435c93a966505511688f139f3d7837
5
5
  SHA512:
6
- metadata.gz: faaf1c0d1ac146c4ac6f78d1ef77a3604d749eada8886ffac8908d812a322f1496fe9f0b521d83eb1563ae39701d71cf3e875f4beda9e5403f2dd9ea65fc9498
7
- data.tar.gz: 003d59a65094af75ccb9ffb6703bbd2373232c8668dddc4a14a11156adb37a658cff1b8fdf3fe550635cc2593a54de498560f9a6bdf3bc08e3d5d7ea4a0d92da
6
+ metadata.gz: a508fd6bb549cdee9b7dd8a9e1fedf9ef0ede81b739fc7cec3e29fc610119e42528e21696bde282847725633b1f029896194b28a4b7bbb0ba6ae5a364cb84a17
7
+ data.tar.gz: 912d6c0e1db45ecf52cd5c80be7780f6385400f0e84e3ab88076ba639ce8e25569b9a373fa32f23901e50ffa1f73837302425927300301abff04f66e39570557
@@ -1,3 +1,17 @@
1
+ # 2.0.0 (2020-08-07)
2
+
3
+ ## Breaking changes
4
+
5
+ * Support dropped for Ruby 2.3, 2.4 and for Rails 4.2, 5.0, and 5.1
6
+
7
+ ## Fixes
8
+
9
+ * Fix 'TypeError - hash key raise is not a Symbol' when used with Rails 6.0.3 [#28](https://github.com/iGEL/it/pull/28)
10
+ *Jason Barnabe* and *wingice*
11
+ * Fix Ruby 2.7 deprecations
12
+ * `It.link` now accepts `ActiveSupport::SafeBuffer`s
13
+ Reported by *James Balazs*
14
+
1
15
  # 1.0.0 (2017-06-03)
2
16
 
3
17
  * Allow whitespace after the colon without considering it part of the value [#20](https://github.com/iGEL/it/pull/20)
data/README.md CHANGED
@@ -1,11 +1,10 @@
1
- [![Code Climate](http://img.shields.io/codeclimate/github/iGEL/it.svg?style=flat)](https://codeclimate.com/github/iGEL/it)
2
- [![Build Status](http://img.shields.io/travis/iGEL/it/master.svg?style=flat)](https://travis-ci.org/iGEL/it)
3
- [![Coverage](http://img.shields.io/coveralls/iGEL/it/master.svg?style=flat)](https://coveralls.io/r/iGEL/it)
1
+ [![Maintainability](https://api.codeclimate.com/v1/badges/6f705ee22d3eb7422d8f/maintainability)](https://codeclimate.com/github/iGEL/it/maintainability)
2
+ [![Build Status](http://img.shields.io/travis/iGEL/it/main.svg?style=flat)](https://travis-ci.org/iGEL/it)
3
+ [![Coverage](http://img.shields.io/coveralls/iGEL/it/main.svg?style=flat)](https://coveralls.io/r/iGEL/it)
4
4
  [![Rubygems](http://img.shields.io/gem/v/it.svg?style=flat)](http://rubygems.org/gems/it)
5
5
  [![Github Issues](http://img.shields.io/github/issues/iGEL/it.svg?style=flat)](https://github.com/iGEL/it/issues)
6
- [![Dependency Status](http://img.shields.io/gemnasium/iGEL/it.svg?style=flat)](https://gemnasium.com/iGEL/it)
7
6
 
8
- Tested against Ruby 2.4, 2.3, 2.2, head, and jruby 9.1.10.0 and Rails 5.1, 5.0, and 4.2
7
+ Tested against Ruby 2.7, 2.6, and 2.5 and Rails 6.0 and 5.2
9
8
 
10
9
  What is **it**?
11
10
  =============
@@ -51,14 +50,14 @@ You may have as many links inside your translations as you like, and normal inte
51
50
 
52
51
  ```yaml
53
52
  en:
54
- copy: "Read the %{guide:Rails I18n guide} for more than %{advises} advises. Fork it at {repo:github}."
53
+ copy: "Read the %{guide:Rails I18n guide} for more than %{advises} advises. Fork it at %{repo:github}."
55
54
  ```
56
55
 
57
56
  ```erb
58
57
  <%=it "copy",
59
58
  guide: It.link("http://guides.rubyonrails.org/i18n.html"),
60
59
  advices: 100,
61
- repo: It.link("https://github.com/lifo/docrails/tree/master/railties/guides") %>
60
+ repo: It.link("https://github.com/rails/rails") %>
62
61
  ```
63
62
 
64
63
  As you see above, unless the interpolation name is `link` or starts with `link_` or ends with `_link`, you need to call `It.link` to create a link. The advantage of `It.link`: You may specify options like you would with `link_to`:
@@ -105,7 +104,7 @@ en:
105
104
  ```
106
105
 
107
106
  ```erb
108
- https://github.com/lifo/docrails/tree/master/railties/guides
107
+ https://github.com/rails/rails
109
108
  <%= it "mail_copy", link: It.link("http://www.rubyonrails.org/") %>
110
109
 
111
110
  Plain mail:
data/it.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'it/version'
4
4
 
@@ -15,13 +15,14 @@ Gem::Specification.new do |spec|
15
15
  spec.files = %w[MIT-LICENSE README.md Rakefile Gemfile CHANGELOG.md it.gemspec] + Dir['lib/**/*.rb']
16
16
  spec.require_paths = ['lib']
17
17
 
18
+ spec.required_ruby_version = '>= 2.5.0'
18
19
  spec.add_dependency 'actionpack', '>= 3.0.0'
19
20
 
20
- spec.add_development_dependency 'bundler', '~> 1.7'
21
- spec.add_development_dependency 'rake', '~> 12'
22
- spec.add_development_dependency 'rspec', '~> 3.2'
21
+ spec.add_development_dependency 'bundler'
23
22
  spec.add_development_dependency 'coveralls'
24
23
  spec.add_development_dependency 'nokogiri'
25
- spec.add_development_dependency 'rubocop'
24
+ spec.add_development_dependency 'rake', '~> 12'
26
25
  spec.add_development_dependency 'reek'
26
+ spec.add_development_dependency 'rspec', '~> 3.2'
27
+ spec.add_development_dependency 'rubocop'
27
28
  end
data/lib/it.rb CHANGED
@@ -15,7 +15,7 @@ module It
15
15
  # It outside of your views. See documentation at Helper#it
16
16
  def self.it(identifier, options = {})
17
17
  Parser.new(
18
- I18n.t(identifier, Parser.backend_options(options)),
18
+ I18n.t(identifier, **Parser.backend_options(options).symbolize_keys),
19
19
  options.stringify_keys
20
20
  ).process
21
21
  end
@@ -40,7 +40,7 @@ module It
40
40
  #
41
41
  def it(identifier, options = {})
42
42
  It::Parser.new(
43
- t(identifier, It::Parser.backend_options(options)),
43
+ t(identifier, **It::Parser.backend_options(options).symbolize_keys),
44
44
  options.stringify_keys
45
45
  ).process
46
46
  end
@@ -45,9 +45,7 @@ module It
45
45
 
46
46
  # Convert keys with String arguments into It::Links, if they are named link, link_* or *_link
47
47
  def convert_link
48
- if key =~ /(\Alink\z|_link\z|\Alink_)/ && value.is_a?(String)
49
- @value = It::Link.new(value)
50
- end
48
+ @value = It::Link.new(value) if key =~ /(\Alink\z|_link\z|\Alink_)/ && value.is_a?(String)
51
49
  end
52
50
 
53
51
  def process_it_tag
@@ -7,7 +7,7 @@ module It
7
7
 
8
8
  # See It.link for details. You can do everything there and save 6 characters.
9
9
  def initialize(href, options = {})
10
- raise TypeError, 'Invalid href given' unless [Hash, String].include?(href.class)
10
+ raise TypeError, 'Invalid href given' unless [Hash, String, ActiveSupport::SafeBuffer].include?(href.class)
11
11
 
12
12
  super(:a, options)
13
13
  @href = href
@@ -3,7 +3,7 @@ module It
3
3
  class Parser
4
4
  attr_reader :string, :options
5
5
 
6
- INTERPOLATION_REGEXP = /%\{[^{}]+\}/
6
+ INTERPOLATION_REGEXP = /%\{[^{}]+\}/.freeze
7
7
 
8
8
  def self.backend_options(options)
9
9
  options.with_indifferent_access.slice(:default, :locale, :scope)
@@ -1,3 +1,3 @@
1
1
  module It
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Barre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-02 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -28,60 +28,60 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.7'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.7'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '12'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '12'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.2'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.2'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: coveralls
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '12'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '12'
83
83
  - !ruby/object:Gem::Dependency
84
- name: nokogiri
84
+ name: reek
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,21 +95,21 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop
98
+ name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '3.2'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '3.2'
111
111
  - !ruby/object:Gem::Dependency
112
- name: reek
112
+ name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -155,15 +155,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - ">="
157
157
  - !ruby/object:Gem::Version
158
- version: '0'
158
+ version: 2.5.0
159
159
  required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.6.10
165
+ rubygems_version: 3.1.2
167
166
  signing_key:
168
167
  specification_version: 4
169
168
  summary: A helper for links and other html tags in your translations