msmg_public 0.3.2 → 0.3.3

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
  SHA1:
3
- metadata.gz: 878267b5b9b655fa3fb5e63b749833a039c67077
4
- data.tar.gz: d6f1051a68328b03f017a8b2cd0471267ada6e62
3
+ metadata.gz: c34461ad08e751f2693c1daf866f4fdd36c8d445
4
+ data.tar.gz: 957cdc8eda027b40c2127bd964f32bffb7ced940
5
5
  SHA512:
6
- metadata.gz: 9f4e9cd4320222b7eecda105cd10a72623ac56bdf5e5e1955e3ad67d620c1eb454be7ca882caa34691340819be63a016d049285a71988c76b4a985964558259f
7
- data.tar.gz: fb8c9aa07a0c95c727abe36a1f9501cb355ac3b2d98387ff1f200e53f29ad4e25bc20743505cb1a45796787fa2973ff1c90df9c1b2cb12d2bd3a7758b8cb8963
6
+ metadata.gz: ed9ba4ef7eac771b7dd1075dcec00ddc06adf0cfc8e94d1e2413cee99ed1564c1ce8284ba19edcee8b18c1c46aab36e119c7704cb82fc0bd86e4229bfe3f870b
7
+ data.tar.gz: 92dc2656c9b524c326fc57eb2ba6550de9b081f1db4b923d778af0335072cb46b851a38ce7dd90f36858828df0e636f499fd092bb3269466e2799a71afba051f
@@ -7,14 +7,13 @@ module BuilderPattern
7
7
  klass.class_eval do
8
8
  private_class_method :new
9
9
 
10
- @__attr_mandatory = []
11
- @__attr_optional = []
12
-
13
10
  def self.attr_mandatory(*fields)
11
+ @__attr_mandatory ||= []
14
12
  @__attr_mandatory |= fields.map { |field| "@#{field}".to_sym }
15
13
  end
16
14
 
17
15
  def self.attr_optional(*fields)
16
+ @__attr_optional ||= []
18
17
  @__attr_optional |= fields.map { |field| "@#{field}".to_sym }
19
18
  end
20
19
 
@@ -30,8 +29,14 @@ module BuilderPattern
30
29
  def build
31
30
  collector = OpenStruct.new
32
31
  yield collector
33
- mandatory = self.class.instance_variable_get(:@__attr_mandatory)
34
- allowed = self.class.instance_variable_get(:@__attr_optional) | mandatory
32
+ mandatory = self.class.ancestors.map do |level|
33
+ level.instance_variable_get(:@__attr_mandatory)
34
+ end
35
+ .compact.flatten.uniq
36
+ allowed = self.class.ancestors.map do |level|
37
+ level.instance_variable_get(:@__attr_optional)
38
+ end
39
+ .compact.flatten | mandatory
35
40
  # Migrate the state to instance variables
36
41
  collector.each_pair do |key, val|
37
42
  key = "@#{key}".to_sym
data/msmg_public.gemspec CHANGED
@@ -9,7 +9,7 @@ $LOAD_PATH.merge! [File.expand_path('lib', __dir__)]
9
9
  Gem::Specification.new do |spec|
10
10
  raise 'RubyGems 2.0 or newer is required.' unless spec.respond_to?(:metadata)
11
11
  spec.name = 'msmg_public'
12
- spec.version = '0.3.2'
12
+ spec.version = '0.3.3'
13
13
  spec.authors = ['Andrew Smith']
14
14
  spec.email = ['andrew.smith at moneysupermarket.com']
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msmg_public
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-01 00:00:00.000000000 Z
11
+ date: 2018-06-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: MSM pubicly available Ruby
14
14
  email: