subroutine 4.5.0 → 5.0.0.alpha

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: 719502dade68ec34e525c97130a82e7ca6b3a5406002882a7916a93ad80d9099
4
- data.tar.gz: 3eadd2bb114ef5d1724864b67462d0b563f241e21c3b61c92ea47366022aba9a
3
+ metadata.gz: 303c840aa8c1160127aefad35c51f98b6f85d3b24231cb256b6dbebb1b7316a9
4
+ data.tar.gz: 45e2c676ef66e7fb3282c30c793edf20dcc748a7e263cf9c41d81e0f5e13ce75
5
5
  SHA512:
6
- metadata.gz: a57ccde1e224deab1dd2854091b5a1117b026b3feabb2d47626b7227a9905c370fdd95d3aadce201d0f1a84d7409ff225bff20fb9fba07b8444c7b77b069f30c
7
- data.tar.gz: 750f373e085dfa7a91b78c49f187f9df728a7a03794bde4806d49ae8742c52dcc2f462ba9d4ef2db203e6df190d24dede8f124ef2811af5d5ca4085f7c475411
6
+ metadata.gz: 21bea30ad507b474915b6b5dcfd5c901f189f35dd484b755e49608879cd259e43b70d7ca6d27121db1b80b89cb000454a16dba5b886eb1c651a2b866910185da
7
+ data.tar.gz: 570dcacb9c6c09a9879aa012faccea7d8dce18591a5c47b6415b708ca06a04ac6eef9ef8f88da449d439d4abf8702b509021c33e9bb1baf7769fe03304fdfdca
@@ -85,6 +85,7 @@ module Subroutine
85
85
  child_opts = inheritable_options
86
86
  child_opts.merge!(opts)
87
87
  child_opts[:association_name] = as
88
+ child_opts[:allow_override] = true
88
89
  ComponentConfiguration.new(name, child_opts)
89
90
  end
90
91
 
@@ -66,6 +66,8 @@ module Subroutine
66
66
  if options[:type]&.to_sym == :association
67
67
  config = ::Subroutine::AssociationFields::Configuration.new(field_name, options)
68
68
 
69
+ field_without_association(config.as, config)
70
+
69
71
  if config.polymorphic?
70
72
  field config.foreign_type_method, config.build_foreign_type_field
71
73
  else
@@ -77,8 +79,6 @@ module Subroutine
77
79
  end
78
80
 
79
81
  field config.foreign_key_method, config.build_foreign_key_field
80
-
81
- field_without_association(config.as, config)
82
82
  else
83
83
  field_without_association(field_name, options)
84
84
  end
@@ -7,6 +7,8 @@ require "subroutine/fields/mass_assignment_error"
7
7
  module Subroutine
8
8
  module Fields
9
9
 
10
+ DuplicateFieldError = Class.new(StandardError)
11
+
10
12
  extend ActiveSupport::Concern
11
13
 
12
14
  def self.allowed_input_classes
@@ -30,6 +32,11 @@ module Subroutine
30
32
  module ClassMethods
31
33
 
32
34
  def field(field_name, options = {})
35
+
36
+ if field_configurations.key?(field_name.to_sym) && !options[:allow_override]
37
+ raise DuplicateFieldError, "#{field_name} is already defined on #{self}. Add `allow_override: true` to reconfigure the field."
38
+ end
39
+
33
40
  config = ::Subroutine::Fields::Configuration.from(field_name, options)
34
41
  config.validate!
35
42
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Subroutine
4
4
 
5
- MAJOR = 4
6
- MINOR = 5
5
+ MAJOR = 5
6
+ MINOR = 0
7
7
  PATCH = 0
8
- PRE = nil
8
+ PRE = "alpha"
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 5.0.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-06-04 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: activemodel
@@ -225,6 +226,7 @@ licenses:
225
226
  metadata:
226
227
  allowed_push_host: https://rubygems.org
227
228
  rubygems_mfa_required: 'true'
229
+ post_install_message:
228
230
  rdoc_options: []
229
231
  require_paths:
230
232
  - lib
@@ -239,7 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
241
  - !ruby/object:Gem::Version
240
242
  version: '0'
241
243
  requirements: []
242
- rubygems_version: 3.6.9
244
+ rubygems_version: 3.5.22
245
+ signing_key:
243
246
  specification_version: 4
244
247
  summary: Feature-driven operation objects.
245
248
  test_files: []