rack-locale_memorable 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ffe06754e47f1f4e78b11466c82b3e6eec83328a39ced2f7643531cf13663d5
4
- data.tar.gz: feeb7868eb676e2b53e2e8cb6d6f72344c54ce0f1552a0bac81ade90afbf1d63
3
+ metadata.gz: fa0c01424f46339976170cf682e5bfa2dc9d9fa7d07dd43f8a879364b0aad2b3
4
+ data.tar.gz: 15f3723e2480bf0383cc10f34c5fe317006ecde186f89ec25846db244e69194c
5
5
  SHA512:
6
- metadata.gz: 110f31d182de015b71c26bf2b9d952537c4444966efabe116c2a67d8eee59196d24515cb37a34df66f0d3d1fb308e74626ec11aac1d43f38feb932b79726f3f9
7
- data.tar.gz: 16359f3551313019d6b346e071b520fd2dae13e44d6715149f95e2bc15ad77bfe7688aca30e3349b373ef40d9808a0c5bb657056192ab9def3ccc9a02971e920
6
+ metadata.gz: b18e7390e5a87613d9b67f4373587ea38b412396698f1f25f3f5cebb6b094d637616b13177733bb9c1e2968c534763953f7490ff1eea4915ebc9eca9fd067d8e
7
+ data.tar.gz: ed28ed315f1f27d1e6f6780a7ab2117a848cff1f609247baf806189d995eacc56c397890c524abf28438dbd4a9e482b4a006dcea8205268c5b0379faa417d9ad
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.0] - 2022-10-01
4
+
5
+ ### Changed
6
+
7
+ - remove activesupport https://github.com/nov/rack-locale_memorable/pull/2
8
+
3
9
  ## [0.5.0] - 2022-10-01
4
10
 
5
11
  ### Changed
@@ -28,7 +28,7 @@ module Rack
28
28
  end
29
29
 
30
30
  def primary_locale_from(locales)
31
- available_locales_from(locales)&.first if locales.present?
31
+ available_locales_from(locales)&.first if locales
32
32
  end
33
33
 
34
34
  def available_locales_from(locales)
@@ -3,10 +3,10 @@
3
3
  module Rack
4
4
  class LocaleMemorable
5
5
  class Response < Rack::Response
6
- def remember_locale(explicit_locale, key:, lifetime: 1.year, domain: nil, path: '/', http_only: true, secure: true)
6
+ def remember_locale(explicit_locale, key:, lifetime: 31536000, domain: nil, path: '/', http_only: true, secure: true)
7
7
  set_cookie key, {
8
8
  value: explicit_locale,
9
- expires: lifetime.from_now,
9
+ expires: Time.at(Time.now.to_i + lifetime.to_i),
10
10
  domain: domain,
11
11
  path: path,
12
12
  http_only: http_only,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  class LocaleMemorable
5
- VERSION = '0.5.0'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support'
4
- require 'active_support/core_ext'
3
+ require 'i18n'
5
4
  require 'http/accept'
6
5
  require 'rack'
7
6
 
@@ -20,7 +19,7 @@ module Rack
20
19
  env['rack.locale'] = I18n.locale.to_s
21
20
  status, headers, body = @app.call(env)
22
21
  response = Response.new body, status, headers
23
- if request.explicit_locale.present?
22
+ if request.explicit_locale
24
23
  response.remember_locale request.explicit_locale, key: @cookie_key, **@cookie_options
25
24
  end
26
25
  response.finish
@@ -32,7 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'rack'
33
33
  spec.add_dependency 'i18n'
34
34
  spec.add_dependency 'http-accept'
35
- spec.add_dependency 'activesupport'
36
35
  spec.add_development_dependency 'rake'
37
36
  spec.add_development_dependency 'rspec'
38
37
  spec.add_development_dependency 'simplecov'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-locale_memorable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: activesupport
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement