subroutine 4.1.2 → 4.1.4

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: 15a66f7e3077a9ab4f4e18ea83b392d2e5f75df8e66800ae5490c3c21043c135
4
- data.tar.gz: d700305226f76f5a4cb06b68720c22a5ba9b6d524a1dedce247f567d07c3d2f0
3
+ metadata.gz: ced171264f2691b06090ebb341c3bb2db51ec830ff1437ac40e6e043cfa855fc
4
+ data.tar.gz: '08979c16af5ed2659919f5ba6c273f4a49945f4b646d10d7da0752bc0701547a'
5
5
  SHA512:
6
- metadata.gz: 4aa17ca9430260a3071105938f58d8ecf1100ce130907529539fe26723e80d80d50a6077fca1902175439bde526db2a1ce65c2041aa35a24f383c147e6ff12fa
7
- data.tar.gz: 2e6b8034633a1a114e21c23d723e211b7c6e2a80c44341eaaafb4ff03e4e2bb78cb25a49126664206a2bd2951a8e602d95cb0036ff264b30cd85f15725fa51bb
6
+ metadata.gz: c41378df7c3f4ca1964a202473c7d4ad7eea0e820c1aba9368224011c9a475d3caff781a95754778c0963912a9d518b59e3abbbf4384ef0d2208425174f3f9db
7
+ data.tar.gz: a1085fff72c585454bb2f4278bada45706546553695bd291877e21100a435cc63fb0175934d83cf3b32e6592b9a4b3a08403c49d63715ae4636d66c561ccbe4b
data/.bundler-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.22
@@ -8,7 +8,7 @@ updates:
8
8
  time: "09:00"
9
9
  timezone: "America/New_York"
10
10
  commit-message:
11
- prefix: "[github-actions] "
11
+ prefix: "[github-actions] "
12
12
  - package-ecosystem: "bundler"
13
13
  directory: "/"
14
14
  schedule:
@@ -19,6 +19,6 @@ updates:
19
19
  open-pull-requests-limit: 20
20
20
  insecure-external-code-execution: deny
21
21
  allow:
22
- - dependency-type: "all"
22
+ - dependency-type: "all"
23
23
  commit-message:
24
- prefix: "[bundler] "
24
+ prefix: "[bundler] "
@@ -2,31 +2,26 @@ name: build
2
2
  on:
3
3
  pull_request:
4
4
  push:
5
- branches:
6
- - main
5
+ branches:
6
+ - main
7
7
  jobs:
8
8
  build:
9
9
  runs-on: ubuntu-latest
10
- continue-on-error: ${{ matrix.experimental }}
11
10
  strategy:
12
11
  fail-fast: false
13
12
  matrix:
14
- ruby-version: [2.7.8]
15
- experimental: [false]
16
- include:
17
- - ruby-version: 3.0
18
- experimental: true
19
- - ruby-version: 3.1
20
- experimental: true
21
- - ruby-version: 3.2
22
- experimental: true
13
+ ruby-version: [3.0, 3.1, 3.2]
23
14
  steps:
24
15
  - uses: actions/checkout@v4
25
16
  with:
26
- show-progress: 'false'
17
+ show-progress: "false"
18
+ - name: get bundler version
19
+ run: echo "BUNDLER=$(cat .bundler-version)" >> $GITHUB_ENV
27
20
  - uses: ruby/setup-ruby@v1
28
21
  with:
29
22
  ruby-version: ${{ matrix.ruby-version }}
30
- bundler-cache: true # runs `bundle install` and caches installed gems automatically
23
+ bundler: ${{ env.BUNDLER }}
24
+ bundler-cache: true
25
+ - run: bundle install
31
26
  - run: bundle exec appraisal install
32
27
  - run: bundle exec appraisal rake test
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.8
1
+ 3.2.6
data/Appraisals CHANGED
@@ -7,3 +7,13 @@ appraise "rails-7.0" do
7
7
  gem 'activemodel', '~> 7.0.0'
8
8
  gem 'actionpack', '~> 7.0.0'
9
9
  end
10
+
11
+ appraise "rails-7.1" do
12
+ gem 'activemodel', '~> 7.1.0'
13
+ gem 'actionpack', '~> 7.1.0'
14
+ end
15
+
16
+ appraise "rails-7.2" do
17
+ gem 'activemodel', '~> 7.2.0'
18
+ gem 'actionpack', '~> 7.2.0'
19
+ end
data/CHANGELOG.MD CHANGED
@@ -1,3 +1,19 @@
1
+ ## Subroutine 4.1.4
2
+
3
+ Fields using the time/timestamp/datetime caster will now default back to the old behavior, and use a `precision:` option to opt-in to the new behavior introduced in `v4.1.1`.
4
+
5
+ `precision: :seconds` will retain the old behavior of always parsing to a new Time object
6
+ with floored sub-second precision, but applied more forcefully than before as it would have parsed whatever you passed to it. (This is the default, now.)
7
+
8
+ `precision: :high` will now use the new functionality of re-using Time objects when they
9
+ are passed in, or if not parsing exactly the provided string as to a Time object.
10
+
11
+ ## Subroutine 4.1.1
12
+
13
+ Fields using the time/timestamp/datetime caster will now return exactly the passed in value
14
+ if it acts like a time object (`acts_like?(:time)`/`acts_like_time?`), instead of serializing
15
+ to string and re-parsing to a Time object. This fixes issues with losing usec precision.
16
+
1
17
  ## Subroutine 4.1.0
2
18
 
3
19
  A field can no opt out of the natural assignment behavior of ActiveSupport::HashWithIndifferentAccess. Top level param groups are still accessible via indifferent access but if a field sets the `bypass_indifferent_assignment` option to `true` the HashWithIndifferentAccess assignment behavior will be bypassed in favor of direct Hash-like assignment.
data/Gemfile CHANGED
@@ -5,7 +5,4 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in subroutine.gemspec
6
6
  gemspec
7
7
 
8
- # Locking to specific git sha to work around
9
- # https://github.com/thoughtbot/appraisal/issues/211
10
- # until appraisal v3 is released
11
- gem "appraisal", github: "thoughtbot/appraisal", ref: "b200e636903"
8
+ gem "appraisal"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "appraisal", github: "thoughtbot/appraisal", ref: "b200e636903"
5
+ gem "appraisal"
6
6
  gem "activemodel", "~> 6.1.0"
7
7
  gem "actionpack", "~> 6.1.0"
8
8
 
@@ -1,95 +1,91 @@
1
- GIT
2
- remote: https://github.com/thoughtbot/appraisal.git
3
- revision: b200e636903700098bef25f4f51dbc4c46e4c04c
4
- ref: b200e636903
5
- specs:
6
- appraisal (2.4.1)
7
- bundler
8
- rake
9
- thor (>= 0.14.0)
10
-
11
1
  PATH
12
2
  remote: ..
13
3
  specs:
14
- subroutine (3.0.0)
4
+ subroutine (4.1.0)
15
5
  activemodel (>= 6.1)
16
6
  activesupport (>= 6.1)
17
7
 
18
8
  GEM
19
9
  remote: https://rubygems.org/
20
10
  specs:
21
- actionpack (6.1.7.4)
22
- actionview (= 6.1.7.4)
23
- activesupport (= 6.1.7.4)
11
+ actionpack (6.1.7.8)
12
+ actionview (= 6.1.7.8)
13
+ activesupport (= 6.1.7.8)
24
14
  rack (~> 2.0, >= 2.0.9)
25
15
  rack-test (>= 0.6.3)
26
16
  rails-dom-testing (~> 2.0)
27
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
28
- actionview (6.1.7.4)
29
- activesupport (= 6.1.7.4)
18
+ actionview (6.1.7.8)
19
+ activesupport (= 6.1.7.8)
30
20
  builder (~> 3.1)
31
21
  erubi (~> 1.4)
32
22
  rails-dom-testing (~> 2.0)
33
23
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
34
- activemodel (6.1.7.4)
35
- activesupport (= 6.1.7.4)
36
- activesupport (6.1.7.4)
24
+ activemodel (6.1.7.8)
25
+ activesupport (= 6.1.7.8)
26
+ activesupport (6.1.7.8)
37
27
  concurrent-ruby (~> 1.0, >= 1.0.2)
38
28
  i18n (>= 1.6, < 2)
39
29
  minitest (>= 5.1)
40
30
  tzinfo (~> 2.0)
41
31
  zeitwerk (~> 2.3)
42
32
  ansi (1.5.0)
43
- builder (3.2.4)
33
+ appraisal (2.5.0)
34
+ bundler
35
+ rake
36
+ thor (>= 0.14.0)
37
+ builder (3.3.0)
44
38
  byebug (11.1.3)
45
- concurrent-ruby (1.2.2)
39
+ concurrent-ruby (1.3.4)
46
40
  crass (1.0.6)
47
- erubi (1.12.0)
48
- i18n (1.14.1)
41
+ erubi (1.13.0)
42
+ i18n (1.14.6)
49
43
  concurrent-ruby (~> 1.0)
50
- loofah (2.21.3)
44
+ loofah (2.22.0)
51
45
  crass (~> 1.0.2)
52
46
  nokogiri (>= 1.12.0)
53
- m (1.6.1)
47
+ m (1.6.2)
54
48
  method_source (>= 0.6.7)
55
49
  rake (>= 0.9.2.2)
56
- method_source (1.0.0)
57
- minitest (5.18.1)
58
- minitest-reporters (1.6.0)
50
+ method_source (1.1.0)
51
+ mini_portile2 (2.8.7)
52
+ minitest (5.25.1)
53
+ minitest-reporters (1.7.1)
59
54
  ansi
60
55
  builder
61
56
  minitest (>= 5.0)
62
57
  ruby-progressbar
63
- mocha (2.0.4)
58
+ mocha (2.4.5)
64
59
  ruby2_keywords (>= 0.0.5)
65
- nokogiri (1.15.2-arm64-darwin)
60
+ nokogiri (1.16.7)
61
+ mini_portile2 (~> 2.8.2)
66
62
  racc (~> 1.4)
67
- racc (1.7.1)
68
- rack (2.2.7)
63
+ racc (1.8.1)
64
+ rack (2.2.9)
69
65
  rack-test (2.1.0)
70
66
  rack (>= 1.3)
71
- rails-dom-testing (2.0.3)
72
- activesupport (>= 4.2.0)
67
+ rails-dom-testing (2.2.0)
68
+ activesupport (>= 5.0.0)
69
+ minitest
73
70
  nokogiri (>= 1.6)
74
71
  rails-html-sanitizer (1.6.0)
75
72
  loofah (~> 2.21)
76
73
  nokogiri (~> 1.14)
77
- rake (13.0.6)
74
+ rake (13.2.1)
78
75
  ruby-progressbar (1.13.0)
79
76
  ruby2_keywords (0.0.5)
80
- thor (1.2.2)
77
+ thor (1.3.2)
81
78
  tzinfo (2.0.6)
82
79
  concurrent-ruby (~> 1.0)
83
- zeitwerk (2.6.8)
80
+ zeitwerk (2.6.18)
84
81
 
85
82
  PLATFORMS
86
- arm64-darwin-22
83
+ ruby
87
84
 
88
85
  DEPENDENCIES
89
86
  actionpack (~> 6.1.0)
90
87
  activemodel (~> 6.1.0)
91
- appraisal!
92
- bundler
88
+ appraisal
93
89
  byebug
94
90
  m
95
91
  minitest
@@ -99,4 +95,4 @@ DEPENDENCIES
99
95
  subroutine!
100
96
 
101
97
  BUNDLED WITH
102
- 2.4.7
98
+ 2.5.22
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "appraisal", github: "thoughtbot/appraisal", ref: "b200e636903"
5
+ gem "appraisal"
6
6
  gem "activemodel", "~> 7.0.0"
7
7
  gem "actionpack", "~> 7.0.0"
8
8
 
@@ -1,93 +1,89 @@
1
- GIT
2
- remote: https://github.com/thoughtbot/appraisal.git
3
- revision: b200e636903700098bef25f4f51dbc4c46e4c04c
4
- ref: b200e636903
5
- specs:
6
- appraisal (2.4.1)
7
- bundler
8
- rake
9
- thor (>= 0.14.0)
10
-
11
1
  PATH
12
2
  remote: ..
13
3
  specs:
14
- subroutine (3.0.0)
4
+ subroutine (4.1.0)
15
5
  activemodel (>= 6.1)
16
6
  activesupport (>= 6.1)
17
7
 
18
8
  GEM
19
9
  remote: https://rubygems.org/
20
10
  specs:
21
- actionpack (7.0.5.1)
22
- actionview (= 7.0.5.1)
23
- activesupport (= 7.0.5.1)
11
+ actionpack (7.0.8.4)
12
+ actionview (= 7.0.8.4)
13
+ activesupport (= 7.0.8.4)
24
14
  rack (~> 2.0, >= 2.2.4)
25
15
  rack-test (>= 0.6.3)
26
16
  rails-dom-testing (~> 2.0)
27
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
28
- actionview (7.0.5.1)
29
- activesupport (= 7.0.5.1)
18
+ actionview (7.0.8.4)
19
+ activesupport (= 7.0.8.4)
30
20
  builder (~> 3.1)
31
21
  erubi (~> 1.4)
32
22
  rails-dom-testing (~> 2.0)
33
23
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
34
- activemodel (7.0.5.1)
35
- activesupport (= 7.0.5.1)
36
- activesupport (7.0.5.1)
24
+ activemodel (7.0.8.4)
25
+ activesupport (= 7.0.8.4)
26
+ activesupport (7.0.8.4)
37
27
  concurrent-ruby (~> 1.0, >= 1.0.2)
38
28
  i18n (>= 1.6, < 2)
39
29
  minitest (>= 5.1)
40
30
  tzinfo (~> 2.0)
41
31
  ansi (1.5.0)
42
- builder (3.2.4)
32
+ appraisal (2.5.0)
33
+ bundler
34
+ rake
35
+ thor (>= 0.14.0)
36
+ builder (3.3.0)
43
37
  byebug (11.1.3)
44
- concurrent-ruby (1.2.2)
38
+ concurrent-ruby (1.3.4)
45
39
  crass (1.0.6)
46
- erubi (1.12.0)
47
- i18n (1.14.1)
40
+ erubi (1.13.0)
41
+ i18n (1.14.6)
48
42
  concurrent-ruby (~> 1.0)
49
- loofah (2.21.3)
43
+ loofah (2.22.0)
50
44
  crass (~> 1.0.2)
51
45
  nokogiri (>= 1.12.0)
52
- m (1.6.1)
46
+ m (1.6.2)
53
47
  method_source (>= 0.6.7)
54
48
  rake (>= 0.9.2.2)
55
- method_source (1.0.0)
56
- minitest (5.18.1)
57
- minitest-reporters (1.6.0)
49
+ method_source (1.1.0)
50
+ mini_portile2 (2.8.7)
51
+ minitest (5.25.1)
52
+ minitest-reporters (1.7.1)
58
53
  ansi
59
54
  builder
60
55
  minitest (>= 5.0)
61
56
  ruby-progressbar
62
- mocha (2.0.4)
57
+ mocha (2.4.5)
63
58
  ruby2_keywords (>= 0.0.5)
64
- nokogiri (1.15.2-arm64-darwin)
59
+ nokogiri (1.16.7)
60
+ mini_portile2 (~> 2.8.2)
65
61
  racc (~> 1.4)
66
- racc (1.7.1)
67
- rack (2.2.7)
62
+ racc (1.8.1)
63
+ rack (2.2.9)
68
64
  rack-test (2.1.0)
69
65
  rack (>= 1.3)
70
- rails-dom-testing (2.0.3)
71
- activesupport (>= 4.2.0)
66
+ rails-dom-testing (2.2.0)
67
+ activesupport (>= 5.0.0)
68
+ minitest
72
69
  nokogiri (>= 1.6)
73
70
  rails-html-sanitizer (1.6.0)
74
71
  loofah (~> 2.21)
75
72
  nokogiri (~> 1.14)
76
- rake (13.0.6)
73
+ rake (13.2.1)
77
74
  ruby-progressbar (1.13.0)
78
75
  ruby2_keywords (0.0.5)
79
- thor (1.2.2)
76
+ thor (1.3.2)
80
77
  tzinfo (2.0.6)
81
78
  concurrent-ruby (~> 1.0)
82
79
 
83
80
  PLATFORMS
84
- arm64-darwin-22
81
+ ruby
85
82
 
86
83
  DEPENDENCIES
87
84
  actionpack (~> 7.0.0)
88
85
  activemodel (~> 7.0.0)
89
- appraisal!
90
- bundler
86
+ appraisal
91
87
  byebug
92
88
  m
93
89
  minitest
@@ -97,4 +93,4 @@ DEPENDENCIES
97
93
  subroutine!
98
94
 
99
95
  BUNDLED WITH
100
- 2.4.7
96
+ 2.5.22
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "activemodel", "~> 7.1.0"
7
+ gem "actionpack", "~> 7.1.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,109 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ subroutine (4.1.0)
5
+ activemodel (>= 6.1)
6
+ activesupport (>= 6.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (7.1.4)
12
+ actionview (= 7.1.4)
13
+ activesupport (= 7.1.4)
14
+ nokogiri (>= 1.8.5)
15
+ racc
16
+ rack (>= 2.2.4)
17
+ rack-session (>= 1.0.1)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.2)
20
+ rails-html-sanitizer (~> 1.6)
21
+ actionview (7.1.4)
22
+ activesupport (= 7.1.4)
23
+ builder (~> 3.1)
24
+ erubi (~> 1.11)
25
+ rails-dom-testing (~> 2.2)
26
+ rails-html-sanitizer (~> 1.6)
27
+ activemodel (7.1.4)
28
+ activesupport (= 7.1.4)
29
+ activesupport (7.1.4)
30
+ base64
31
+ bigdecimal
32
+ concurrent-ruby (~> 1.0, >= 1.0.2)
33
+ connection_pool (>= 2.2.5)
34
+ drb
35
+ i18n (>= 1.6, < 2)
36
+ minitest (>= 5.1)
37
+ mutex_m
38
+ tzinfo (~> 2.0)
39
+ ansi (1.5.0)
40
+ appraisal (2.5.0)
41
+ bundler
42
+ rake
43
+ thor (>= 0.14.0)
44
+ base64 (0.2.0)
45
+ bigdecimal (3.1.8)
46
+ builder (3.3.0)
47
+ byebug (11.1.3)
48
+ concurrent-ruby (1.3.4)
49
+ connection_pool (2.4.1)
50
+ crass (1.0.6)
51
+ drb (2.2.1)
52
+ erubi (1.13.0)
53
+ i18n (1.14.6)
54
+ concurrent-ruby (~> 1.0)
55
+ loofah (2.22.0)
56
+ crass (~> 1.0.2)
57
+ nokogiri (>= 1.12.0)
58
+ m (1.6.2)
59
+ method_source (>= 0.6.7)
60
+ rake (>= 0.9.2.2)
61
+ method_source (1.1.0)
62
+ minitest (5.25.1)
63
+ minitest-reporters (1.7.1)
64
+ ansi
65
+ builder
66
+ minitest (>= 5.0)
67
+ ruby-progressbar
68
+ mocha (2.4.5)
69
+ ruby2_keywords (>= 0.0.5)
70
+ mutex_m (0.2.0)
71
+ nokogiri (1.16.7-arm64-darwin)
72
+ racc (~> 1.4)
73
+ racc (1.8.1)
74
+ rack (3.1.7)
75
+ rack-session (2.0.0)
76
+ rack (>= 3.0.0)
77
+ rack-test (2.1.0)
78
+ rack (>= 1.3)
79
+ rails-dom-testing (2.2.0)
80
+ activesupport (>= 5.0.0)
81
+ minitest
82
+ nokogiri (>= 1.6)
83
+ rails-html-sanitizer (1.6.0)
84
+ loofah (~> 2.21)
85
+ nokogiri (~> 1.14)
86
+ rake (13.2.1)
87
+ ruby-progressbar (1.13.0)
88
+ ruby2_keywords (0.0.5)
89
+ thor (1.3.2)
90
+ tzinfo (2.0.6)
91
+ concurrent-ruby (~> 1.0)
92
+
93
+ PLATFORMS
94
+ arm64-darwin
95
+
96
+ DEPENDENCIES
97
+ actionpack (~> 7.1.0)
98
+ activemodel (~> 7.1.0)
99
+ appraisal
100
+ byebug
101
+ m
102
+ minitest
103
+ minitest-reporters
104
+ mocha
105
+ rake
106
+ subroutine!
107
+
108
+ BUNDLED WITH
109
+ 2.5.22
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "activemodel", "~> 7.2.0"
7
+ gem "actionpack", "~> 7.2.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ subroutine (4.1.0)
5
+ activemodel (>= 6.1)
6
+ activesupport (>= 6.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (7.2.1)
12
+ actionview (= 7.2.1)
13
+ activesupport (= 7.2.1)
14
+ nokogiri (>= 1.8.5)
15
+ racc
16
+ rack (>= 2.2.4, < 3.2)
17
+ rack-session (>= 1.0.1)
18
+ rack-test (>= 0.6.3)
19
+ rails-dom-testing (~> 2.2)
20
+ rails-html-sanitizer (~> 1.6)
21
+ useragent (~> 0.16)
22
+ actionview (7.2.1)
23
+ activesupport (= 7.2.1)
24
+ builder (~> 3.1)
25
+ erubi (~> 1.11)
26
+ rails-dom-testing (~> 2.2)
27
+ rails-html-sanitizer (~> 1.6)
28
+ activemodel (7.2.1)
29
+ activesupport (= 7.2.1)
30
+ activesupport (7.2.1)
31
+ base64
32
+ bigdecimal
33
+ concurrent-ruby (~> 1.0, >= 1.3.1)
34
+ connection_pool (>= 2.2.5)
35
+ drb
36
+ i18n (>= 1.6, < 2)
37
+ logger (>= 1.4.2)
38
+ minitest (>= 5.1)
39
+ securerandom (>= 0.3)
40
+ tzinfo (~> 2.0, >= 2.0.5)
41
+ ansi (1.5.0)
42
+ appraisal (2.5.0)
43
+ bundler
44
+ rake
45
+ thor (>= 0.14.0)
46
+ base64 (0.2.0)
47
+ bigdecimal (3.1.8)
48
+ builder (3.3.0)
49
+ byebug (11.1.3)
50
+ concurrent-ruby (1.3.4)
51
+ connection_pool (2.4.1)
52
+ crass (1.0.6)
53
+ drb (2.2.1)
54
+ erubi (1.13.0)
55
+ i18n (1.14.6)
56
+ concurrent-ruby (~> 1.0)
57
+ logger (1.6.1)
58
+ loofah (2.22.0)
59
+ crass (~> 1.0.2)
60
+ nokogiri (>= 1.12.0)
61
+ m (1.6.2)
62
+ method_source (>= 0.6.7)
63
+ rake (>= 0.9.2.2)
64
+ method_source (1.1.0)
65
+ minitest (5.25.1)
66
+ minitest-reporters (1.7.1)
67
+ ansi
68
+ builder
69
+ minitest (>= 5.0)
70
+ ruby-progressbar
71
+ mocha (2.4.5)
72
+ ruby2_keywords (>= 0.0.5)
73
+ nokogiri (1.16.7-arm64-darwin)
74
+ racc (~> 1.4)
75
+ racc (1.8.1)
76
+ rack (3.1.7)
77
+ rack-session (2.0.0)
78
+ rack (>= 3.0.0)
79
+ rack-test (2.1.0)
80
+ rack (>= 1.3)
81
+ rails-dom-testing (2.2.0)
82
+ activesupport (>= 5.0.0)
83
+ minitest
84
+ nokogiri (>= 1.6)
85
+ rails-html-sanitizer (1.6.0)
86
+ loofah (~> 2.21)
87
+ nokogiri (~> 1.14)
88
+ rake (13.2.1)
89
+ ruby-progressbar (1.13.0)
90
+ ruby2_keywords (0.0.5)
91
+ securerandom (0.3.1)
92
+ thor (1.3.2)
93
+ tzinfo (2.0.6)
94
+ concurrent-ruby (~> 1.0)
95
+ useragent (0.16.10)
96
+
97
+ PLATFORMS
98
+ arm64-darwin
99
+
100
+ DEPENDENCIES
101
+ actionpack (~> 7.2.0)
102
+ activemodel (~> 7.2.0)
103
+ appraisal
104
+ byebug
105
+ m
106
+ minitest
107
+ minitest-reporters
108
+ mocha
109
+ rake
110
+ subroutine!
111
+
112
+ BUNDLED WITH
113
+ 2.5.22
@@ -4,9 +4,14 @@ require 'date'
4
4
  require 'time'
5
5
  require 'bigdecimal'
6
6
  require 'securerandom'
7
+ require 'active_support/core_ext/date_time/acts_like'
8
+ require 'active_support/core_ext/date_time/calculations'
9
+ require 'active_support/core_ext/object/acts_like'
7
10
  require 'active_support/core_ext/object/blank'
8
11
  require 'active_support/core_ext/object/try'
9
12
  require 'active_support/core_ext/array/wrap'
13
+ require 'active_support/core_ext/time/acts_like'
14
+ require 'active_support/core_ext/time/calculations'
10
15
 
11
16
  module Subroutine
12
17
  module TypeCaster
@@ -115,10 +120,24 @@ end
115
120
  ::Date.parse(String(value))
116
121
  end
117
122
 
118
- ::Subroutine::TypeCaster.register :time, :timestamp, :datetime do |value, _options = {}|
123
+ ::Subroutine::TypeCaster.register :time, :timestamp, :datetime do |value, options = {}|
119
124
  next nil unless value.present?
120
125
 
121
- ::Time.parse(String(value))
126
+ if options[:precision] == :high
127
+ if value.try(:acts_like?, :time)
128
+ value.to_time
129
+ else
130
+ ::Time.parse(String(value))
131
+ end
132
+ else # precision == :seconds
133
+ time = if value.try(:acts_like?, :time)
134
+ value.to_time
135
+ else
136
+ ::Time.parse(String(value))
137
+ end
138
+
139
+ time.change(usec: 0)
140
+ end
122
141
  end
123
142
 
124
143
  ::Subroutine::TypeCaster.register :hash, :object, :hashmap, :dict do |value, _options = {}|
@@ -4,7 +4,7 @@ module Subroutine
4
4
 
5
5
  MAJOR = 4
6
6
  MINOR = 1
7
- PATCH = 2
7
+ PATCH = 4
8
8
  PRE = nil
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
data/subroutine.gemspec CHANGED
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "activesupport", ">= 6.1"
24
24
 
25
25
  spec.add_development_dependency "actionpack", ">= 6.1"
26
- spec.add_development_dependency "bundler"
27
26
  spec.add_development_dependency "byebug"
28
27
  spec.add_development_dependency "m"
29
28
  spec.add_development_dependency "minitest"
@@ -345,5 +345,20 @@ module Subroutine
345
345
  assert_nil op.user
346
346
  end
347
347
 
348
+ def test_inheritable_options_are_inherited_by_child_fields
349
+ Subroutine.stubs(:inheritable_field_options).returns(%i[foo bar])
350
+ klass = Class.new(OpWithAssociation) do
351
+ association :buster, foo: true, bar: false, baz: true
352
+ association :mister, polymorphic: true, foo: true, bar: false, baz: true
353
+ end
354
+
355
+ %i[buster_id mister_id mister_type].each do |field_name|
356
+ field = klass.field_configurations.fetch(field_name)
357
+ assert_equal true, field[:foo]
358
+ assert_equal false, field[:bar]
359
+ assert_equal false, field.config.key?(:baz)
360
+ end
361
+ end
362
+
348
363
  end
349
364
  end
@@ -269,7 +269,7 @@ module Subroutine
269
269
  assert_nil op.date_input
270
270
  end
271
271
 
272
- def test_time_inputs
272
+ def test_time_inputs__with_seconds_precision
273
273
  op.time_input = nil
274
274
  assert_nil op.time_input
275
275
 
@@ -284,16 +284,139 @@ module Subroutine
284
284
  assert_equal 0, op.time_input.min
285
285
  assert_equal 0, op.time_input.sec
286
286
 
287
- op.time_input = '2023-05-05T10:00:30Z'
287
+ op.time_input = ::DateTime.new(2022, 12, 22)
288
288
  assert_equal ::Time, op.time_input.class
289
289
  refute_equal ::DateTime, op.time_input.class
290
290
 
291
+ assert_equal 0, op.time_input.utc_offset
292
+ assert_equal 2022, op.time_input.year
293
+ assert_equal 12, op.time_input.month
294
+ assert_equal 22, op.time_input.day
295
+ assert_equal 0, op.time_input.hour
296
+ assert_equal 0, op.time_input.min
297
+ assert_equal 0, op.time_input.sec
298
+
299
+ op.time_input = '2023-05-05T10:00:30.123456Z'
300
+ assert_equal ::Time, op.time_input.class
301
+ refute_equal ::DateTime, op.time_input.class
302
+
303
+ assert_equal 0, op.time_input.utc_offset
291
304
  assert_equal 2023, op.time_input.year
292
305
  assert_equal 5, op.time_input.month
293
306
  assert_equal 5, op.time_input.day
294
307
  assert_equal 10, op.time_input.hour
295
308
  assert_equal 0, op.time_input.min
296
309
  assert_equal 30, op.time_input.sec
310
+ assert_equal 0, op.time_input.usec
311
+
312
+ op.time_input = '2023-05-05T10:00:30Z'
313
+ assert_equal ::Time, op.time_input.class
314
+ assert_equal 0, op.time_input.utc_offset
315
+ assert_equal 2023, op.time_input.year
316
+ assert_equal 5, op.time_input.month
317
+ assert_equal 5, op.time_input.day
318
+ assert_equal 10, op.time_input.hour
319
+ assert_equal 0, op.time_input.min
320
+ assert_equal 30, op.time_input.sec
321
+ assert_equal 0, op.time_input.usec
322
+
323
+ op.time_input = '2024-11-11T16:42:23.246+0100'
324
+ assert_equal ::Time, op.time_input.class
325
+ assert_equal 3600, op.time_input.utc_offset
326
+ assert_equal 2024, op.time_input.year
327
+ assert_equal 11, op.time_input.month
328
+ assert_equal 11, op.time_input.day
329
+ assert_equal 16, op.time_input.hour
330
+ assert_equal 42, op.time_input.min
331
+ assert_equal 23, op.time_input.sec
332
+ assert_equal 0, op.time_input.usec
333
+
334
+ time = Time.at(1678741605.123456).utc
335
+ op.time_input = time
336
+ refute_equal time, op.time_input
337
+ refute_equal time.object_id, op.time_input.object_id
338
+ assert_equal 2023, op.time_input.year
339
+ assert_equal 3, op.time_input.month
340
+ assert_equal 13, op.time_input.day
341
+ assert_equal 21, op.time_input.hour
342
+ assert_equal 6, op.time_input.min
343
+ assert_equal 45, op.time_input.sec
344
+ assert_equal 0, op.time_input.usec
345
+ end
346
+
347
+ def test_time_inputs__with_high_precision
348
+ op.precise_time_input = nil
349
+ assert_nil op.precise_time_input
350
+
351
+ op.precise_time_input = '2022-12-22'
352
+ assert_equal ::Time, op.precise_time_input.class
353
+ refute_equal ::DateTime, op.precise_time_input.class
354
+
355
+ assert_equal 2022, op.precise_time_input.year
356
+ assert_equal 12, op.precise_time_input.month
357
+ assert_equal 22, op.precise_time_input.day
358
+ assert_equal 0, op.precise_time_input.hour
359
+ assert_equal 0, op.precise_time_input.min
360
+ assert_equal 0, op.precise_time_input.sec
361
+
362
+ op.precise_time_input = ::DateTime.new(2022, 12, 22)
363
+ assert_equal ::Time, op.precise_time_input.class
364
+ refute_equal ::DateTime, op.precise_time_input.class
365
+
366
+ assert_equal 0, op.precise_time_input.utc_offset
367
+ assert_equal 2022, op.precise_time_input.year
368
+ assert_equal 12, op.precise_time_input.month
369
+ assert_equal 22, op.precise_time_input.day
370
+ assert_equal 0, op.precise_time_input.hour
371
+ assert_equal 0, op.precise_time_input.min
372
+ assert_equal 0, op.precise_time_input.sec
373
+
374
+ op.precise_time_input = '2023-05-05T10:00:30.123456Z'
375
+ assert_equal ::Time, op.precise_time_input.class
376
+ refute_equal ::DateTime, op.precise_time_input.class
377
+
378
+ assert_equal 0, op.precise_time_input.utc_offset
379
+ assert_equal 2023, op.precise_time_input.year
380
+ assert_equal 5, op.precise_time_input.month
381
+ assert_equal 5, op.precise_time_input.day
382
+ assert_equal 10, op.precise_time_input.hour
383
+ assert_equal 0, op.precise_time_input.min
384
+ assert_equal 30, op.precise_time_input.sec
385
+ assert_equal 123456, op.precise_time_input.usec
386
+
387
+ op.precise_time_input = '2023-05-05T10:00:30Z'
388
+ assert_equal ::Time, op.precise_time_input.class
389
+ assert_equal 0, op.precise_time_input.utc_offset
390
+ assert_equal 2023, op.precise_time_input.year
391
+ assert_equal 5, op.precise_time_input.month
392
+ assert_equal 5, op.precise_time_input.day
393
+ assert_equal 10, op.precise_time_input.hour
394
+ assert_equal 0, op.precise_time_input.min
395
+ assert_equal 30, op.precise_time_input.sec
396
+ assert_equal 0, op.precise_time_input.usec
397
+
398
+ op.precise_time_input = '2024-11-11T16:42:23.246+0100'
399
+ assert_equal ::Time, op.precise_time_input.class
400
+ assert_equal 3600, op.precise_time_input.utc_offset
401
+ assert_equal 2024, op.precise_time_input.year
402
+ assert_equal 11, op.precise_time_input.month
403
+ assert_equal 11, op.precise_time_input.day
404
+ assert_equal 16, op.precise_time_input.hour
405
+ assert_equal 42, op.precise_time_input.min
406
+ assert_equal 23, op.precise_time_input.sec
407
+ assert_equal 246000, op.precise_time_input.usec
408
+
409
+ time = Time.at(1678741605.123456).utc
410
+ op.precise_time_input = time
411
+ assert_equal time, op.precise_time_input
412
+ assert_equal time.object_id, op.precise_time_input.object_id
413
+ assert_equal 2023, op.precise_time_input.year
414
+ assert_equal 3, op.precise_time_input.month
415
+ assert_equal 13, op.precise_time_input.day
416
+ assert_equal 21, op.precise_time_input.hour
417
+ assert_equal 6, op.precise_time_input.min
418
+ assert_equal 45, op.precise_time_input.sec
419
+ assert_equal 123456, op.precise_time_input.usec
297
420
  end
298
421
 
299
422
  def test_iso_date_inputs
data/test/support/ops.rb CHANGED
@@ -173,6 +173,7 @@ class TypeCastOp < ::Subroutine::Op
173
173
  boolean :boolean_input
174
174
  date :date_input
175
175
  time :time_input, default: -> { Time.now }
176
+ time :precise_time_input, precision: :high
176
177
  iso_date :iso_date_input
177
178
  iso_time :iso_time_input
178
179
  object :object_input
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '6.1'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
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: byebug
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -157,6 +143,7 @@ executables: []
157
143
  extensions: []
158
144
  extra_rdoc_files: []
159
145
  files:
146
+ - ".bundler-version"
160
147
  - ".github/CODEOWNERS"
161
148
  - ".github/dependabot.yml"
162
149
  - ".github/workflows/build.yml"
@@ -173,6 +160,10 @@ files:
173
160
  - gemfiles/rails_6.1.gemfile.lock
174
161
  - gemfiles/rails_7.0.gemfile
175
162
  - gemfiles/rails_7.0.gemfile.lock
163
+ - gemfiles/rails_7.1.gemfile
164
+ - gemfiles/rails_7.1.gemfile.lock
165
+ - gemfiles/rails_7.2.gemfile
166
+ - gemfiles/rails_7.2.gemfile.lock
176
167
  - lib/subroutine.rb
177
168
  - lib/subroutine/association_fields.rb
178
169
  - lib/subroutine/association_fields/association_type_mismatch_error.rb
@@ -230,6 +221,10 @@ test_files:
230
221
  - gemfiles/rails_6.1.gemfile.lock
231
222
  - gemfiles/rails_7.0.gemfile
232
223
  - gemfiles/rails_7.0.gemfile.lock
224
+ - gemfiles/rails_7.1.gemfile
225
+ - gemfiles/rails_7.1.gemfile.lock
226
+ - gemfiles/rails_7.2.gemfile
227
+ - gemfiles/rails_7.2.gemfile.lock
233
228
  - test/subroutine/association_test.rb
234
229
  - test/subroutine/auth_test.rb
235
230
  - test/subroutine/base_test.rb