tdc 0.4.3 → 0.4.3.1

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: 8f5936018f214ecc5b2c99c96aaeaa02b01b1376ba09266202b82662dc3f0cce
4
- data.tar.gz: f2572c85877de786307abe6ad4b3e7720cc9d3acd02398523f4d779e0dbbdf57
3
+ metadata.gz: f01cdb5f72c9481d031888d6c1729d6ba6976c79184807dfeb4213fa3205ee99
4
+ data.tar.gz: 64ef598c74252a48925ad77c9f779df6c7a45957bb8b2cf641122981c9cfcc30
5
5
  SHA512:
6
- metadata.gz: 85846a6e8b1d30f3ed7eaeb893f4cc9cc3982723789c47bae6673fa91b65e54f7f0c4de8d05cd0f2989a2165ebb952b4311cabd22e0f38aabcea337bb39e158e
7
- data.tar.gz: b05b075225180aa3711691d3ac6000cc9f9a2508fb11b82a6e01dd864092e42624e0b8bb157b4a03c139629a87711b4a083ad83f3e42eb1da78edd26a26b57aa
6
+ metadata.gz: d093ea28c783c4a5b62c951c815cfb915c7ae7cf13ec2e97cb6ddaceedb09b968b6bb6bf9d80723d8146edac1c7bb6c562d59dec957d074cd67f985a0ce4c79f
7
+ data.tar.gz: c99360136e1857226fef356850499c8aa4bfbe5762c808ab115e4ca40bf4a8f9b097d06dc7c277e0b50e77e9655a2056dc544ca733552238c6de3b203b391c37
@@ -3,7 +3,10 @@ module Tdc
3
3
  #
4
4
  # Creates ghost methods for use in generators.
5
5
  #
6
- # All ghost methods are named 'key'_definition where 'key' is a key into the instance_definition hash.
6
+ # All ghost methods are named 'key'_definition or 'key'_definition_optional where 'key' is
7
+ # a key into the instance_definition hash.
8
+ #
9
+ # Choose optional if the key may not be present in the instance_definition.
7
10
  #
8
11
  # Example:
9
12
  #
@@ -11,6 +14,7 @@ module Tdc
11
14
  # ghost methods could be used to refer to the value associated with those keys:
12
15
  #
13
16
  # line_definition
17
+ # line_definition_optional
14
18
  # replenishment_parameters_definition
15
19
  #
16
20
  module DefinitionSourcable
@@ -33,9 +37,9 @@ module Tdc
33
37
  private
34
38
 
35
39
  def method_missing(method, *args)
36
- if definition?(method)
40
+ if ghost_definition?(method)
37
41
  definition_source.fetch(method.to_s.gsub(/_definition$/, ""))
38
- elsif optional_definition?(method)
42
+ elsif ghost_optional_definition?(method)
39
43
  definition_source[method.to_s.gsub(/_definition_optional$/, "")]
40
44
  else
41
45
  super
@@ -43,18 +47,14 @@ module Tdc
43
47
  end
44
48
 
45
49
  def respond_to_missing?(method, include_all = false) # rubocop:disable Style/OptionalBooleanParameter
46
- definition?(method) || definition_optional?(method) ? true : super
47
- end
48
-
49
- def transform_method_to_definition_source_key(method)
50
- method.to_s.gsub(/_definition$/, "")
50
+ ghost_definition?(method) || ghost_optional_definition?(method) ? true : super
51
51
  end
52
52
 
53
- def definition?(method)
53
+ def ghost_definition?(method)
54
54
  method.to_s.end_with?("_definition")
55
55
  end
56
56
 
57
- def optional_definition?(method)
57
+ def ghost_optional_definition?(method)
58
58
  method.to_s.end_with?("_definition_optional")
59
59
  end
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module Tdc
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell