padrino-support 0.16.2 → 0.18.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6ae97ade30c7223a30941b681db1619b84e77f8147b443c3273f1a6af737500
|
|
4
|
+
data.tar.gz: e65a3d754dadafb8dd9890916076082cd9f50616c11fa1eac1699f6a5e6b7d13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53821f7cfb96aa4b4bc66d990b1aa5a6cf07dee3b8e383bcda088a4675bbf369349eac19725629e90206341766fb569ac91a977e46f88a8cb2cc65d595d4119a
|
|
7
|
+
data.tar.gz: 437b398efef5c89ae96e5a19fdb5182a5fb061084630f789e8c3dd7f02f5c630641ef591471040949ac6f8fc545e2a879674b05cc0593f30530d7f744e6f750c
|
|
@@ -22,21 +22,25 @@ module Padrino
|
|
|
22
22
|
plural(/([m|l])ouse$/i, '\1ice')
|
|
23
23
|
|
|
24
24
|
singular(/s$/i, '')
|
|
25
|
+
singular(/(ss)$/i, '\1')
|
|
25
26
|
singular(/([ti])a$/i, '\1um')
|
|
26
|
-
singular(/(analy|ba|cri|diagno|parenthe|progno|synop|the)ses$/i, '\1sis')
|
|
27
|
+
singular(/(analy|ba|cri|diagno|parenthe|progno|synop|the)(sis|ses)$/i, '\1sis')
|
|
27
28
|
singular(/([^f])ves$/i, '\1fe')
|
|
28
29
|
singular(/([h|t]ive)s$/i, '\1')
|
|
29
30
|
singular(/([lr])ves$/i, '\1f')
|
|
30
31
|
singular(/([^aeiouy]|qu)ies$/i, '\1y')
|
|
31
32
|
singular(/(m)ovies$/i, '\1ovie')
|
|
32
33
|
singular(/(x|ch|ss|sh)es$/i, '\1')
|
|
33
|
-
singular(
|
|
34
|
-
singular(/
|
|
34
|
+
singular(/^(m|l)ice$/i, '\1ouse')
|
|
35
|
+
singular(/(bus)(es)?$/i, '\1')
|
|
35
36
|
singular(/oes$/i, 'o')
|
|
36
37
|
singular(/shoes$/i, 'shoe')
|
|
37
38
|
singular(/(alias|(?:stat|octop|vir|b)us)es$/i, '\1')
|
|
39
|
+
singular(/(octop|vir)(us|i)$/i, '\1us')
|
|
40
|
+
singular(/(alias|status)(es)?$/i, '\1')
|
|
38
41
|
singular(/(vert|ind)ices$/i, '\1ex')
|
|
39
42
|
singular(/matrices$/i, 'matrix')
|
|
43
|
+
singular(/(database)s$/i, '\1')
|
|
40
44
|
|
|
41
45
|
irregular('person', 'people')
|
|
42
46
|
irregular('man', 'men')
|
|
@@ -71,6 +71,7 @@ module Padrino
|
|
|
71
71
|
# irregular 'person', 'people'
|
|
72
72
|
def self.irregular(singular, plural)
|
|
73
73
|
plural(Regexp.new("(#{singular[0, 1]})#{singular[1..]}$", 'i'), "\\1#{plural[1..]}")
|
|
74
|
+
singular(Regexp.new("(#{singular[0, 1]})#{singular[1..]}$", 'i'), "\\1#{singular[1..]}")
|
|
74
75
|
singular(Regexp.new("(#{plural[0, 1]})#{plural[1..]}$", 'i'), "\\1#{singular[1..]}")
|
|
75
76
|
end
|
|
76
77
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require_relative 'helper'
|
|
2
|
+
require 'padrino-support/inflections'
|
|
3
|
+
|
|
4
|
+
describe 'Padrino::Inflections' do
|
|
5
|
+
# Each row is a word, its singular and its plural as ActiveSupport's default inflections give them.
|
|
6
|
+
# Rows without a plural are words whose Padrino plural differs from ActiveSupport's on purpose:
|
|
7
|
+
# Sequel derives default table names from pluralize, so changing a plural would rename existing tables.
|
|
8
|
+
activesupport_inflections = [
|
|
9
|
+
%w[status status statuses],
|
|
10
|
+
%w[statuses status statuses],
|
|
11
|
+
%w[address address addresses],
|
|
12
|
+
%w[addresses address addresses],
|
|
13
|
+
%w[user_address user_address user_addresses],
|
|
14
|
+
%w[class class classes],
|
|
15
|
+
%w[process process processes],
|
|
16
|
+
%w[business business businesses],
|
|
17
|
+
%w[alias alias aliases],
|
|
18
|
+
%w[aliases alias aliases],
|
|
19
|
+
%w[bus bus buses],
|
|
20
|
+
%w[buses bus buses],
|
|
21
|
+
%w[analysis analysis analyses],
|
|
22
|
+
%w[analyses analysis analyses],
|
|
23
|
+
%w[basis basis bases],
|
|
24
|
+
%w[crisis crisis crises],
|
|
25
|
+
%w[diagnosis diagnosis diagnoses],
|
|
26
|
+
%w[thesis thesis theses],
|
|
27
|
+
%w[database database databases],
|
|
28
|
+
%w[databases database databases],
|
|
29
|
+
%w[octopi octopus],
|
|
30
|
+
%w[virus virus],
|
|
31
|
+
%w[police police],
|
|
32
|
+
%w[person person people],
|
|
33
|
+
%w[people person],
|
|
34
|
+
%w[men man],
|
|
35
|
+
%w[children child],
|
|
36
|
+
%w[testis testis testes],
|
|
37
|
+
%w[slice slice slices],
|
|
38
|
+
%w[blouse blouse],
|
|
39
|
+
%w[mouse mouse mice],
|
|
40
|
+
%w[post post posts],
|
|
41
|
+
%w[categories category categories],
|
|
42
|
+
%w[boxes box boxes],
|
|
43
|
+
%w[wives wife wives]
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
it 'should be tested without ActiveSupport, which it would delegate to' do
|
|
47
|
+
refute_respond_to '', :singularize
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
activesupport_inflections.each do |word, singular, plural|
|
|
51
|
+
it "should singularize #{word} as #{singular}" do
|
|
52
|
+
assert_equal singular, Padrino::Inflections.singularize(word)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
next unless plural
|
|
56
|
+
|
|
57
|
+
it "should pluralize #{word} as #{plural}" do
|
|
58
|
+
assert_equal plural, Padrino::Inflections.pluralize(word)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: padrino-support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.18.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Padrino Team
|
|
@@ -12,7 +12,7 @@ authors:
|
|
|
12
12
|
autorequire:
|
|
13
13
|
bindir: bin
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date: 2026-10-
|
|
15
|
+
date: 2026-10-31 00:00:00.000000000 Z
|
|
16
16
|
dependencies: []
|
|
17
17
|
description: A number of support methods and extensions for Padrino framework
|
|
18
18
|
email: padrinorb@gmail.com
|
|
@@ -55,6 +55,7 @@ files:
|
|
|
55
55
|
- padrino-support.gemspec
|
|
56
56
|
- test/helper.rb
|
|
57
57
|
- test/test_colorize.rb
|
|
58
|
+
- test/test_inflections.rb
|
|
58
59
|
- test/test_utils.rb
|
|
59
60
|
homepage: http://www.padrinorb.com
|
|
60
61
|
licenses:
|
|
@@ -76,11 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
77
|
- !ruby/object:Gem::Version
|
|
77
78
|
version: 1.3.6
|
|
78
79
|
requirements: []
|
|
79
|
-
rubygems_version: 3.5.
|
|
80
|
+
rubygems_version: 3.5.22
|
|
80
81
|
signing_key:
|
|
81
82
|
specification_version: 4
|
|
82
83
|
summary: Support for padrino
|
|
83
|
-
test_files:
|
|
84
|
-
- test/helper.rb
|
|
85
|
-
- test/test_colorize.rb
|
|
86
|
-
- test/test_utils.rb
|
|
84
|
+
test_files: []
|