limitable 2.0.0 → 2.0.1
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/limitable/locale.rb +2 -2
- data/lib/limitable/version.rb +1 -1
- data/lib/limitable.rb +10 -10
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c335fa86982f21956881f0c1c3be6e5daee3dc7a6a84ca2de981ccf63b6aba06
|
4
|
+
data.tar.gz: 309c1771137400899b3e24e4d71d8e3c0da8f0020fa597581c9b40704118260e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2a2d4150c455dda3f4034797400549fc993ce0cefca77ba3eb4a256b441f08f4e4be0c217b4b97fdc77f7050b61346dd4ff3b3439f80f6d0f0ab85db2268b1f
|
7
|
+
data.tar.gz: 2623f3c517f71e764be0010c82da08de385ba5e3e4b496c0a472cbb6cb81a39a29c597bcbb8c0ccb54ae288a38ccc61cd82302326f7b4a68bf3dcc59edb52b6b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [2.0.1](https://github.com/benmelz/limitable/compare/v2.0.0...v2.0.1) (2025-04-03)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add support for rails 8.0 ([#112](https://github.com/benmelz/limitable/issues/112)) ([db56929](https://github.com/benmelz/limitable/commit/db56929c74f51d43a87484d9562261b96910315c))
|
7
|
+
|
1
8
|
# [2.0.0](https://github.com/benmelz/limitable/compare/v1.1.0...v2.0.0) (2023-07-30)
|
2
9
|
|
3
10
|
|
data/lib/limitable/locale.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "i18n"
|
4
4
|
|
5
5
|
module Limitable
|
6
6
|
# == Limitable::Locale
|
@@ -8,6 +8,6 @@ module Limitable
|
|
8
8
|
# Loads the default limitable custom translations into i18n.
|
9
9
|
#
|
10
10
|
module Locale
|
11
|
-
I18n.load_path << File.expand_path(
|
11
|
+
I18n.load_path << File.expand_path("locale/en.yml", __dir__)
|
12
12
|
end
|
13
13
|
end
|
data/lib/limitable/version.rb
CHANGED
data/lib/limitable.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
3
|
+
require "active_record"
|
4
|
+
require "i18n"
|
5
|
+
require_relative "limitable/base"
|
6
|
+
require_relative "limitable/locale"
|
7
|
+
require_relative "limitable/version"
|
8
8
|
|
9
9
|
# == Limitable
|
10
10
|
#
|
@@ -48,8 +48,8 @@ module Limitable
|
|
48
48
|
end
|
49
49
|
next unless value.is_a? Integer
|
50
50
|
|
51
|
-
errors.add column_name, I18n.t(
|
52
|
-
errors.add column_name, I18n.t(
|
51
|
+
errors.add column_name, I18n.t("limitable.integer_limit_exceeded.lower", limit: min) if value < min
|
52
|
+
errors.add column_name, I18n.t("limitable.integer_limit_exceeded.upper", limit: max) if value > max
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -58,7 +58,7 @@ module Limitable
|
|
58
58
|
value = self.class.type_for_attribute(column_name).serialize self[column_name]
|
59
59
|
next unless value.is_a?(String) && value.bytesize > limit
|
60
60
|
|
61
|
-
errors.add column_name, I18n.t(
|
61
|
+
errors.add column_name, I18n.t("limitable.string_limit_exceeded", limit: limit)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -67,7 +67,7 @@ module Limitable
|
|
67
67
|
value = self.class.type_for_attribute(column_name).serialize self[column_name]
|
68
68
|
next unless value.is_a?(String) && value.bytesize > limit
|
69
69
|
|
70
|
-
errors.add column_name, I18n.t(
|
70
|
+
errors.add column_name, I18n.t("limitable.text_limit_exceeded", limit: limit)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -76,7 +76,7 @@ module Limitable
|
|
76
76
|
value = self.class.type_for_attribute(column_name).serialize self[column_name]
|
77
77
|
next unless value.is_a?(ActiveModel::Type::Binary::Data) && value.to_s.bytesize > limit
|
78
78
|
|
79
|
-
errors.add column_name, I18n.t(
|
79
|
+
errors.add column_name, I18n.t("limitable.binary_limit_exceeded", limit: limit)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limitable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Melz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '6'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '8'
|
22
|
+
version: '8.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '6'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '8'
|
32
|
+
version: '8.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: i18n
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,9 +72,9 @@ licenses:
|
|
72
72
|
metadata:
|
73
73
|
homepage_uri: https://github.com/benmelz/limitable
|
74
74
|
source_code_uri: https://github.com/benmelz/limitable
|
75
|
-
changelog_uri: https://github.com/benmelz/limitable/blob/v2.0.
|
75
|
+
changelog_uri: https://github.com/benmelz/limitable/blob/v2.0.1/CHANGELOG.md
|
76
76
|
rubygems_mfa_required: 'true'
|
77
|
-
post_install_message:
|
77
|
+
post_install_message:
|
78
78
|
rdoc_options: []
|
79
79
|
require_paths:
|
80
80
|
- lib
|
@@ -89,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
93
|
-
signing_key:
|
92
|
+
rubygems_version: 3.5.22
|
93
|
+
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Inferred database limit validations for ActiveRecord.
|
96
96
|
test_files: []
|