tdc 0.4.2 → 0.4.3

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: 83b4405ab9ec996fbab35d7228931e03d5bf18966df916b631d36d6aecca4393
4
- data.tar.gz: 942728ff3d354bb5dc516c777606766b798ae218b4fd85ec4823cfad7e9d1875
3
+ metadata.gz: 8f5936018f214ecc5b2c99c96aaeaa02b01b1376ba09266202b82662dc3f0cce
4
+ data.tar.gz: f2572c85877de786307abe6ad4b3e7720cc9d3acd02398523f4d779e0dbbdf57
5
5
  SHA512:
6
- metadata.gz: 1a783d54d2a3af00fcd0d8366b1a55190503fda3350308179f5eb778f2fab6f3601b7c6eded92bd27a123a39303160ffa19381902228e8e11ab5f4213deda20c
7
- data.tar.gz: 5cc30405e4369c739e5a77370bf663d0813a2a72e2bdbaa7791bd8c1f966c5337c477689c4f968b82d20ee41bc3d22f94baa0731fb0d38948f6001137d4f56c6
6
+ metadata.gz: 85846a6e8b1d30f3ed7eaeb893f4cc9cc3982723789c47bae6673fa91b65e54f7f0c4de8d05cd0f2989a2165ebb952b4311cabd22e0f38aabcea337bb39e158e
7
+ data.tar.gz: b05b075225180aa3711691d3ac6000cc9f9a2508fb11b82a6e01dd864092e42624e0b8bb157b4a03c139629a87711b4a083ad83f3e42eb1da78edd26a26b57aa
@@ -6,8 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.3] - 2020-08-25
10
+
11
+ #### New Features
12
+
13
+ - Support optional definitions
14
+
9
15
  ## [0.4.2] - 2020-08-22
10
16
 
17
+ #### Breaking Changes
18
+
11
19
  - Extended attributes use `_xa` suffix
12
20
 
13
21
  ## [0.4.1] - 2020-08-22
@@ -33,20 +33,30 @@ module Tdc
33
33
  private
34
34
 
35
35
  def method_missing(method, *args)
36
- key = transform_method_to_definition_source_key(method)
37
-
38
- definition_source&.key?(key) ? definition_source.fetch(key) : super
36
+ if definition?(method)
37
+ definition_source.fetch(method.to_s.gsub(/_definition$/, ""))
38
+ elsif optional_definition?(method)
39
+ definition_source[method.to_s.gsub(/_definition_optional$/, "")]
40
+ else
41
+ super
42
+ end
39
43
  end
40
44
 
41
45
  def respond_to_missing?(method, include_all = false) # rubocop:disable Style/OptionalBooleanParameter
42
- key = transform_method_to_definition_source_key(method)
43
-
44
- definition_source&.key?(key) ? true : super
46
+ definition?(method) || definition_optional?(method) ? true : super
45
47
  end
46
48
 
47
49
  def transform_method_to_definition_source_key(method)
48
50
  method.to_s.gsub(/_definition$/, "")
49
51
  end
52
+
53
+ def definition?(method)
54
+ method.to_s.end_with?("_definition")
55
+ end
56
+
57
+ def optional_definition?(method)
58
+ method.to_s.end_with?("_definition_optional")
59
+ end
50
60
  end
51
61
  end
52
62
  end
@@ -1,3 +1,3 @@
1
1
  module Tdc
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-22 00:00:00.000000000 Z
11
+ date: 2020-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport