route_translator 5.10.0 → 6.0.0.alpha1

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
- SHA256:
3
- metadata.gz: 85d65dba9c99328f55ebc7cb0f8f7bd0f7583ad5ffd56c73d21d6347799e982f
4
- data.tar.gz: 3f3a658b242e9e420f9d6b988c1a84dcc79c9b94d0abef9bb6202539b41da978
2
+ SHA1:
3
+ metadata.gz: c4171b2df923521e8166337add614fba7f3a38a7
4
+ data.tar.gz: c4f3b540804c81c9095f6dd51591f155fd94e0bd
5
5
  SHA512:
6
- metadata.gz: d614520abeb9dfb64b673dabeb195f9c15d0ee8c1468b149cda62111a6a35bdd1126e14f9ad38e1967c9321074393489106bed8cccac90404674ab0fbbf0d75b
7
- data.tar.gz: c93966fbc3900a66f683636ace6df7557aff0c7c5ca7cd765260dc7998e1d3f5ef07018abc8fe629a90dcb2b4310f9a769ccc2988d3dd645847873e6b2a7a8e9
6
+ metadata.gz: 3fdbdb4ebd133bec7ce149bfba1fffdf2260be4c8b16c2fbe2d3578966d19db1ad57e11e34dc79ba26c78edd87ed9c7148a0ed4b84621c3dd06588716a939551
7
+ data.tar.gz: 9b7276425620c712608a4c249566271a81f1796c1cfe04b4a0d706e09de215d9f9d23b94ac7c2461b065103b26630214b6813dbc73e01bd58b86022f29918805
@@ -1,69 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## 5.10.0 / 2019-04-25
3
+ ## 6.0.0.alpha1 / 2017-07-23
4
4
 
5
- * [FEATURE] Add Rails 6.0 compatibility
6
- * [ENHANCEMENT] Test against latest Ruby versions
7
-
8
- ## 5.9.0 / 2019-03-14
9
-
10
- * [FEATURE] Add Rails 6.0.0.beta3 compatibility
11
- * [ENHANCEMENT] Test against latest Ruby versions
12
-
13
- ## 5.8.0 / 2019-03-02
14
-
15
- * [FEATURE] Add Rails 6.0.0.beta2 compatibility
16
- * [ENHANCEMENT] Update development dependencies
17
-
18
- ## 5.7.1 / 2019-02-03
19
-
20
- * [ENHANCEMENT] Test against Ruby 2.6.1
21
- * [ENHANCEMENT] Update development dependencies
22
-
23
- ## 5.7.0 / 2019-01-19
24
-
25
- * [FEATURE] Add Rails 6.0.0.beta1 compatibility
26
- * [ENHANCEMENT] Test against latest Ruby versions
27
- * [ENHANCEMENT] Update development dependencies
28
-
29
- ## 5.6.4 / 2018-10-03
30
-
31
- * [ENHANCEMENT] Update development dependencies
32
-
33
- ## 5.6.3 / 2018-06-07
34
-
35
- * [ENHANCEMENT] Update development dependencies
36
-
37
- ## 5.6.2 / 2018-04-10
38
-
39
- * [ENHANCEMENT] Test against Rails 5.2
40
-
41
- ## 5.6.1 / 2018-04-09
42
-
43
- * [BUGFIX] Fix overriding ActionController::Live ([#183](https://github.com/enriclluelles/route_translator/pull/183))
44
- * [ENHANCEMENT] Update development dependencies
45
- * [ENHANCEMENT] Test against latest Ruby versions
46
-
47
- ## 5.6.0 / 2018-02-05
48
-
49
- * [FEATURE] Add Rails 5.2 compatibility
50
- * [ENHANCEMENT] Test against latest Ruby versions
51
- * [ENHANCEMENT] Update development dependencies
52
-
53
- ## 5.5.3 / 2018-01-12
54
-
55
- * [BUGFIX] Fix regression with translations containing spaces ([#181](https://github.com/enriclluelles/route_translator/issues/181))
56
- * [ENHANCEMENT] Update development dependencies
57
-
58
- ## 5.5.2 / 2017-12-27
59
-
60
- * [BUGFIX] Fix regression with translations containing slashes ([#179](https://github.com/enriclluelles/route_translator/pull/179))
61
- * [ENHANCEMENT] Test against latest Ruby versions
62
- * [ENHANCEMENT] Update development dependencies
63
-
64
- ## 5.5.1 / 2017-11-14
65
-
66
- * [BUGFIX] Change spec to reflect Rails 5.1.3 change in url generation ([#172](https://github.com/enriclluelles/route_translator/issues/172))
5
+ * [BUGFIX] Verify host path consistency by default (#91)
6
+ * [FEATURE] Remove the option to verify host path consistency
7
+ * [ENHANCEMENT] Avoid duplicate routes when using host_locales (#87)
67
8
  * [ENHANCEMENT] Update development dependencies
68
9
 
69
10
  ## 5.5.0 / 2017-06-29
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2007 Raul Murciano [http://raul.murciano.net], Domestika INTERNET S.L. [http://domestika.org], 2015 Enric Lluelles [http://enric.lluell.es], 2019 Geremia Taglialatela
3
+ Copyright (c) 2007 Raul Murciano [http://raul.murciano.net], Domestika INTERNET S.L. [http://domestika.org], 2015 Enric Lluelles [http://enric.lluell.es], 2017 Geremia Taglialatela
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,14 +2,15 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/route_translator.svg)](http://badge.fury.io/rb/route_translator)
4
4
  [![Build Status](https://travis-ci.org/enriclluelles/route_translator.svg?branch=master)](https://travis-ci.org/enriclluelles/route_translator)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/1c369ce6147724b353fc/maintainability)](https://codeclimate.com/github/enriclluelles/route_translator/maintainability)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/enriclluelles/route_translator.svg)](https://gemnasium.com/github.com/enriclluelles/route_translator)
6
+ [![Code Climate](https://codeclimate.com/github/enriclluelles/route_translator/badges/gpa.svg)](https://codeclimate.com/github/enriclluelles/route_translator)
6
7
  [![Coverage Status](https://coveralls.io/repos/github/enriclluelles/route_translator/badge.svg?branch=master)](https://coveralls.io/github/enriclluelles/route_translator?branch=master)
7
8
 
8
9
  RouteTranslator is a gem to allow you to manage the translations of your app routes with a simple dictionary format.
9
10
 
10
11
  It started as a fork of the awesome [translate_routes](https://github.com/raul/translate_routes) plugin by [Raúl Murciano](https://github.com/raul).
11
12
 
12
- Right now it works with Rails 5 and Rails 6.0.0.beta1
13
+ Right now it works with Rails 5.0/5.1
13
14
 
14
15
 
15
16
 
@@ -283,10 +284,6 @@ end
283
284
  * **locale_segment_proc**
284
285
  The locale segment of the url will by default be `locale.to_s.downcase`
285
286
  You can supply your own mechanism via a Proc that takes `locale` as an argument, e.g. `config.locale_segment_proc = ->(locale) { locale.to_s.upcase }`
286
- * **verify_host_path_consistency**
287
- By default, if you use different hosts to translate your application, all translated paths will work on all hosts. Set this option to `true` to force
288
- a matching of the host associated locale with the translated path locale as part of the route definition.
289
- Defaults to `false`.
290
287
 
291
288
  ### Host-based Locale
292
289
 
@@ -317,13 +314,13 @@ RouteTranslator.config.host_locales = { 'russia.*' => :ru, '*.com' => :en } #
317
314
  RouteTranslator.config.host_locales = { '*.com' => :en, 'russia.*' => :ru } # 'russia.com' will have locale :en
318
315
  ```
319
316
 
320
- If `host_locales` option is set, the following options will be forced (even if you set to true):
317
+ If `host_locales` option is set, the following options will be forced:
321
318
 
322
319
  ```ruby
320
+ @config.hide_locale = true
321
+ @config.force_locale = false
323
322
  @config.generate_unlocalized_routes = false
324
323
  @config.generate_unnamed_unlocalized_routes = false
325
- @config.force_locale = false
326
- @config.hide_locale = false
327
324
  ```
328
325
 
329
326
  This is to avoid odd behaviour brought about by route conflicts and because `host_locales` forces and hides the host-locale dynamically.
@@ -361,19 +358,6 @@ people_products_favourites_es GET /people/products/fans(.:format) people/
361
358
  The gem will lookup translations under `controllers` scope first and then lookup translations under `routes` scope.
362
359
 
363
360
 
364
- ### Change locale parameter position in the path
365
-
366
- If you need complex routing as `/:country/:locale/path/to/some/pages`, you can specify the position of your locale parameter in the following way:
367
-
368
- ```rb
369
- scope ':country/:locale' do
370
- localized do
371
- root to: 'content#homepage'
372
- end
373
- end
374
- ```
375
-
376
-
377
361
 
378
362
  ## Testing
379
363
  Testing your controllers with routes-translator is easy, just add a locale parameter for your localized routes. Otherwise, an ActionController::UrlGenerationError will raise.
@@ -5,25 +5,23 @@ require 'active_support'
5
5
  require 'route_translator/extensions'
6
6
  require 'route_translator/translator'
7
7
  require 'route_translator/host'
8
- require 'route_translator/host_path_consistency_lambdas'
9
- require 'route_translator/locale_sanitizer'
10
8
 
11
9
  module RouteTranslator
12
10
  extend RouteTranslator::Host
13
11
 
14
- TRANSLATABLE_SEGMENT = /^([-_a-zA-Z0-9]+)(\()?/.freeze
12
+ TRANSLATABLE_SEGMENT = /^([-_a-zA-Z0-9]+)(\()?/
15
13
 
16
14
  Configuration = Struct.new(:available_locales, :disable_fallback, :force_locale,
17
15
  :hide_locale, :host_locales, :generate_unlocalized_routes,
18
16
  :generate_unnamed_unlocalized_routes, :locale_param_key,
19
- :locale_segment_proc, :verify_host_path_consistency)
17
+ :locale_segment_proc)
20
18
 
21
19
  class << self
22
20
  private
23
21
 
24
22
  def resolve_host_locale_config_conflicts
25
23
  @config.force_locale = false
26
- @config.hide_locale = false
24
+ @config.hide_locale = true
27
25
  @config.generate_unlocalized_routes = false
28
26
  @config.generate_unnamed_unlocalized_routes = false
29
27
  end
@@ -42,11 +40,10 @@ module RouteTranslator
42
40
  @config.generate_unnamed_unlocalized_routes ||= false
43
41
  @config.locale_param_key ||= :locale
44
42
  @config.locale_segment_proc ||= nil
45
- @config.verify_host_path_consistency ||= false
46
43
 
47
44
  yield @config if block
48
45
 
49
- resolve_host_locale_config_conflicts unless @config.host_locales.empty?
46
+ resolve_host_locale_config_conflicts if @config.host_locales.present?
50
47
 
51
48
  @config
52
49
  end
@@ -42,5 +42,5 @@ end
42
42
 
43
43
  ActiveSupport.on_load(:action_controller) do
44
44
  ActionController::Base.send :include, RouteTranslator::Controller
45
- ActionController::TestCase.send :include, RouteTranslator::TestCase if ENV['RAILS_ENV'] == 'test'
45
+ ActionController::TestCase.send :include, RouteTranslator::TestCase
46
46
  end
@@ -32,8 +32,8 @@ module ActionDispatch
32
32
 
33
33
  blocks = scope[:blocks] ? scope[:blocks].dup : []
34
34
 
35
- if RouteTranslator.config.verify_host_path_consistency
36
- blocks.push RouteTranslator::HostPathConsistencyLambdas.for_locale(locale)
35
+ if RouteTranslator.config.host_locales.present?
36
+ blocks.push RouteTranslator::Host.lambdas_for_locale(locale)
37
37
  end
38
38
 
39
39
  ::ActionDispatch::Routing::Mapper::Mapping.new(route_set, translated_path_ast, defaults, controller, default_action, scope[:module], to, formatted, scope_constraints, blocks, via, translated_options_constraints, anchor, options)
@@ -5,20 +5,16 @@ module RouteTranslator
5
5
  class << self
6
6
  private
7
7
 
8
+ def lambdas
9
+ @lambdas ||= {}
10
+ end
11
+
8
12
  def regex_for(host_string)
9
13
  escaped = Regexp.escape(host_string).gsub('\*', '.*?').gsub('\.', '\.?')
10
14
  Regexp.new("^#{escaped}$", Regexp::IGNORECASE)
11
15
  end
12
16
  end
13
17
 
14
- def native_locale?(locale)
15
- locale.to_s.match(/native_/).present?
16
- end
17
-
18
- def native_locales
19
- config.host_locales.values.map { |locale| :"native_#{locale}" }
20
- end
21
-
22
18
  module_function
23
19
 
24
20
  def locale_from_host(host)
@@ -28,5 +24,9 @@ module RouteTranslator
28
24
  locales &= I18n.available_locales
29
25
  (locales.first || I18n.default_locale).to_sym
30
26
  end
27
+
28
+ def lambdas_for_locale(locale)
29
+ lambdas[locale] ||= ->(req) { locale == RouteTranslator::Host.locale_from_host(req.host) }
30
+ end
31
31
  end
32
32
  end
@@ -16,7 +16,6 @@ module RouteTranslator
16
16
 
17
17
  def translate_name(name, locale, named_routes_names)
18
18
  return if name.blank?
19
-
20
19
  translated_name = "#{name}_#{locale.to_s.underscore}"
21
20
 
22
21
  translated_name if named_routes_names.exclude?(translated_name.to_sym)
@@ -26,7 +25,7 @@ module RouteTranslator
26
25
  translated_options = options.dup
27
26
 
28
27
  if translated_options.exclude?(RouteTranslator.locale_param_key)
29
- translated_options[RouteTranslator.locale_param_key] = RouteTranslator::LocaleSanitizer.sanitize(locale)
28
+ translated_options[RouteTranslator.locale_param_key] = locale.to_s
30
29
  end
31
30
 
32
31
  translated_options
@@ -53,7 +52,6 @@ module RouteTranslator
53
52
 
54
53
  def available_locales
55
54
  locales = RouteTranslator.available_locales
56
- locales.concat(RouteTranslator.native_locales) if RouteTranslator.native_locales.present?
57
55
  # Make sure the default locale is translated in last place to avoid
58
56
  # problems with wildcards when default locale is omitted in paths. The
59
57
  # default routes will catch all paths like wildcard if it is translated first.
@@ -82,8 +80,6 @@ module RouteTranslator
82
80
 
83
81
  locale = if args_locale
84
82
  args_locale.to_s.underscore
85
- elsif kaller.respond_to?("#{old_name}_native_#{current_locale_name}_#{suffix}")
86
- "native_#{current_locale_name}"
87
83
  elsif kaller.respond_to?("#{old_name}_#{current_locale_name}_#{suffix}")
88
84
  current_locale_name
89
85
  else
@@ -9,8 +9,7 @@ module RouteTranslator
9
9
  private
10
10
 
11
11
  def display_locale?(locale)
12
- !RouteTranslator.config.hide_locale && !RouteTranslator.native_locale?(locale) &&
13
- (!default_locale?(locale) || config_requires_locale?)
12
+ !RouteTranslator.config.hide_locale && (!default_locale?(locale) || config_requires_locale?)
14
13
  end
15
14
 
16
15
  def config_requires_locale?
@@ -32,8 +32,7 @@ module RouteTranslator
32
32
  end
33
33
 
34
34
  def translate_string(str, locale, scope)
35
- sanitized_locale = RouteTranslator::LocaleSanitizer.sanitize(locale)
36
- translated_resource = translate_resource(str, sanitized_locale, scope)
35
+ translated_resource = translate_resource(str, locale.to_s, scope)
37
36
 
38
37
  URI.escape translated_resource
39
38
  end
@@ -9,7 +9,6 @@ module RouteTranslator
9
9
  def add_helpers_to_test_cases(helper_container)
10
10
  %w[ActionController ActionMailer ActionView].each do |klass_name|
11
11
  next unless Module.const_defined?(klass_name)
12
-
13
12
  klass_name.constantize::TestCase.__send__(:include, helper_container)
14
13
  end
15
14
  end
@@ -35,7 +34,7 @@ module RouteTranslator
35
34
  __send__(Translator.route_name_for(args, old_name, suffix, self), *args)
36
35
  end
37
36
 
38
- add_helpers_to_test_cases(helper_container) if ENV['RAILS_ENV'] == 'test'
37
+ add_helpers_to_test_cases(helper_container)
39
38
  end
40
39
  end
41
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RouteTranslator
4
- VERSION = '5.10.0'.freeze
4
+ VERSION = '6.0.0.alpha1'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: route_translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.10.0
4
+ version: 6.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geremia Taglialatela
@@ -10,10 +10,10 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-04-25 00:00:00.000000000 Z
13
+ date: 2017-07-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: actionpack
16
+ name: activesupport
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
19
  - - ">="
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 5.0.0.1
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '6.1'
24
+ version: '5.2'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,9 +31,9 @@ dependencies:
31
31
  version: 5.0.0.1
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '6.1'
34
+ version: '5.2'
35
35
  - !ruby/object:Gem::Dependency
36
- name: activesupport
36
+ name: actionpack
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
@@ -41,7 +41,7 @@ dependencies:
41
41
  version: 5.0.0.1
42
42
  - - "<"
43
43
  - !ruby/object:Gem::Version
44
- version: '6.1'
44
+ version: '5.2'
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,7 +51,7 @@ dependencies:
51
51
  version: 5.0.0.1
52
52
  - - "<"
53
53
  - !ruby/object:Gem::Version
54
- version: '6.1'
54
+ version: '5.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: appraisal
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,50 +70,44 @@ dependencies:
70
70
  name: byebug
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '10.0'
76
- - - "<"
73
+ - - "~>"
77
74
  - !ruby/object:Gem::Version
78
- version: '12'
75
+ version: '9.0'
79
76
  type: :development
80
77
  prerelease: false
81
78
  version_requirements: !ruby/object:Gem::Requirement
82
79
  requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: '10.0'
86
- - - "<"
80
+ - - "~>"
87
81
  - !ruby/object:Gem::Version
88
- version: '12'
82
+ version: '9.0'
89
83
  - !ruby/object:Gem::Dependency
90
- name: coveralls_reborn
84
+ name: coveralls
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - "~>"
94
88
  - !ruby/object:Gem::Version
95
- version: 0.12.0
89
+ version: 0.8.21
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
94
  - - "~>"
101
95
  - !ruby/object:Gem::Version
102
- version: 0.12.0
96
+ version: 0.8.21
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: minitest
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
101
  - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: '5.11'
103
+ version: '5.10'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
108
  - - "~>"
115
109
  - !ruby/object:Gem::Version
116
- version: '5.11'
110
+ version: '5.10'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: rails
119
113
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +117,7 @@ dependencies:
123
117
  version: 5.0.0.1
124
118
  - - "<"
125
119
  - !ruby/object:Gem::Version
126
- version: '6'
120
+ version: '5.2'
127
121
  type: :development
128
122
  prerelease: false
129
123
  version_requirements: !ruby/object:Gem::Requirement
@@ -133,49 +127,49 @@ dependencies:
133
127
  version: 5.0.0.1
134
128
  - - "<"
135
129
  - !ruby/object:Gem::Version
136
- version: '6'
130
+ version: '5.2'
137
131
  - !ruby/object:Gem::Dependency
138
132
  name: rake
139
133
  requirement: !ruby/object:Gem::Requirement
140
134
  requirements:
141
135
  - - "~>"
142
136
  - !ruby/object:Gem::Version
143
- version: '12.3'
137
+ version: '12.0'
144
138
  type: :development
145
139
  prerelease: false
146
140
  version_requirements: !ruby/object:Gem::Requirement
147
141
  requirements:
148
142
  - - "~>"
149
143
  - !ruby/object:Gem::Version
150
- version: '12.3'
144
+ version: '12.0'
151
145
  - !ruby/object:Gem::Dependency
152
146
  name: rubocop
153
147
  requirement: !ruby/object:Gem::Requirement
154
148
  requirements:
155
149
  - - "~>"
156
150
  - !ruby/object:Gem::Version
157
- version: 0.67.2
151
+ version: 0.49.1
158
152
  type: :development
159
153
  prerelease: false
160
154
  version_requirements: !ruby/object:Gem::Requirement
161
155
  requirements:
162
156
  - - "~>"
163
157
  - !ruby/object:Gem::Version
164
- version: 0.67.2
158
+ version: 0.49.1
165
159
  - !ruby/object:Gem::Dependency
166
160
  name: simplecov
167
161
  requirement: !ruby/object:Gem::Requirement
168
162
  requirements:
169
163
  - - "~>"
170
164
  - !ruby/object:Gem::Version
171
- version: 0.16.1
165
+ version: 0.14.1
172
166
  type: :development
173
167
  prerelease: false
174
168
  version_requirements: !ruby/object:Gem::Requirement
175
169
  requirements:
176
170
  - - "~>"
177
171
  - !ruby/object:Gem::Version
178
- version: 0.16.1
172
+ version: 0.14.1
179
173
  description: Translates the Rails routes of your application into the languages defined
180
174
  in your locale files
181
175
  email:
@@ -194,8 +188,6 @@ files:
194
188
  - lib/route_translator/extensions/mapper.rb
195
189
  - lib/route_translator/extensions/route_set.rb
196
190
  - lib/route_translator/host.rb
197
- - lib/route_translator/host_path_consistency_lambdas.rb
198
- - lib/route_translator/locale_sanitizer.rb
199
191
  - lib/route_translator/route.rb
200
192
  - lib/route_translator/translator.rb
201
193
  - lib/route_translator/translator/path.rb
@@ -217,11 +209,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
209
  version: '0'
218
210
  required_rubygems_version: !ruby/object:Gem::Requirement
219
211
  requirements:
220
- - - ">="
212
+ - - ">"
221
213
  - !ruby/object:Gem::Version
222
- version: '0'
214
+ version: 1.3.1
223
215
  requirements: []
224
- rubygems_version: 3.0.3
216
+ rubyforge_project:
217
+ rubygems_version: 2.6.12
225
218
  signing_key:
226
219
  specification_version: 4
227
220
  summary: Translate your Rails routes in a simple manner
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RouteTranslator
4
- module HostPathConsistencyLambdas
5
- class << self
6
- private
7
-
8
- def lambdas
9
- @lambdas ||= {}
10
- end
11
- end
12
-
13
- module_function
14
-
15
- def for_locale(locale)
16
- sanitized_locale = RouteTranslator::LocaleSanitizer.sanitize(locale)
17
-
18
- lambdas[sanitized_locale] ||= ->(req) { sanitized_locale == RouteTranslator::Host.locale_from_host(req.host).to_s }
19
- end
20
- end
21
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RouteTranslator
4
- module LocaleSanitizer
5
- module_function
6
-
7
- def sanitize(locale)
8
- locale.to_s.gsub('native_', '')
9
- end
10
- end
11
- end