subroutine 1.0.0.rc2 → 1.0.0.rc3

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: 83e75f941dcb1020be24cefa722acc6a2fa5689479eac294e50cdfab09a8ea97
4
- data.tar.gz: c7bbe661699afcbfd8ffe6b3da0ca06dd21ea6dd9c29e80265ad507361754483
3
+ metadata.gz: 16421773a13ee6b6c415cd21a1d4c5e43e5e161af42e70260343945b56e660de
4
+ data.tar.gz: 6a8dcec6f523acef96919bc558c07a11689edde60c3f895ae00bb2c8dbaf2c12
5
5
  SHA512:
6
- metadata.gz: 26f93744cee2306723ca1d4949b0cc1d85570cd761ac6254edc50b58ed26d884b81e3a53e478818072077177861d74b5f806527d03ca6716c9e6eba3575b1d8f
7
- data.tar.gz: 157b2503fba1c1866a4bda9e13b04311acf2dd87caf163010025f6495f08305bf63859bbb3d810c3a789bfbb753c0f9bc03f21518805158d79c5490bc66a8ad6
6
+ metadata.gz: '03255082c51014d08e1125e733ba03e5d57e0ee65b1582969fde737f51c7381cdc084eafe86469cf44728dca516dea841ba92516ca72737b110e63fcbaa0d7cd'
7
+ data.tar.gz: 73107c7a4a609b4bfeed24540ecf9fc04a5b423eed16a4ec31c695c9c650cbcd82178d3fc723b2cfed08027b0bd89df82030e70b90049424d95b50e6af548514
@@ -48,11 +48,11 @@ module Subroutine
48
48
  end
49
49
 
50
50
  def build_foreign_key_field
51
- build_child_field(foreign_key_method)
51
+ build_child_field(foreign_key_method, type: :integer)
52
52
  end
53
53
 
54
54
  def build_foreign_type_field
55
- build_child_field(foreign_type_method)
55
+ build_child_field(foreign_type_method, type: :string)
56
56
  end
57
57
 
58
58
  def unscoped?
@@ -65,8 +65,8 @@ module Subroutine
65
65
 
66
66
  protected
67
67
 
68
- def build_child_field(name)
69
- ComponentConfiguration.new(name, inheritable_options.merge(association_name: as))
68
+ def build_child_field(name, opts = {})
69
+ ComponentConfiguration.new(name, inheritable_options.merge(opts).merge(association_name: as))
70
70
  end
71
71
 
72
72
  end
@@ -69,16 +69,17 @@ module Subroutine
69
69
  config = ::Subroutine::AssociationFields::Configuration.new(field_name, options)
70
70
 
71
71
  if config.polymorphic?
72
- string config.foreign_type_method, config.build_foreign_type_field
72
+ field config.foreign_type_method, config.build_foreign_type_field
73
73
  else
74
74
  class_eval <<-EV, __FILE__, __LINE__ + 1
75
+ try(:silence_redefinition_of_method, :#{config.foreign_type_method})
75
76
  def #{config.foreign_type_method}
76
77
  #{config.inferred_class_name.inspect}
77
78
  end
78
79
  EV
79
80
  end
80
81
 
81
- integer config.foreign_key_method, config.build_foreign_key_field
82
+ field config.foreign_key_method, config.build_foreign_key_field
82
83
 
83
84
  field_without_association(config.as, config)
84
85
  else
@@ -119,16 +119,18 @@ module Subroutine
119
119
  end
120
120
 
121
121
  def ensure_field_accessors(config)
122
- if config.field_writer? && !instance_methods.include?(:"#{config.field_name}=")
122
+ if config.field_writer?
123
123
  class_eval <<-EV, __FILE__, __LINE__ + 1
124
+ try(:silence_redefinition_of_method, :#{config.field_name}=)
124
125
  def #{config.field_name}=(v)
125
126
  set_field(:#{config.field_name}, v)
126
127
  end
127
128
  EV
128
129
  end
129
130
 
130
- if config.field_reader? && !instance_methods.include?(:"#{config.field_name}")
131
+ if config.field_reader?
131
132
  class_eval <<-EV, __FILE__, __LINE__ + 1
133
+ try(:silence_redefinition_of_method, :#{config.field_name})
132
134
  def #{config.field_name}
133
135
  get_field(:#{config.field_name})
134
136
  end
@@ -5,7 +5,7 @@ module Subroutine
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc2"
8
+ PRE = "rc3"
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson