cfn-model 0.0.8 → 0.0.9

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
  SHA1:
3
- metadata.gz: 75ed597a2ce9f0c37fd0fa6b2032e001b39a27e6
4
- data.tar.gz: 335e729286fc90e73586bef9c126b6dd04047c8f
3
+ metadata.gz: 9464ccb5aeb4d72a6ee7934e5f703e1740615c5a
4
+ data.tar.gz: a9656a1d245d91fe13b4a173b59a70dd35d9fb18
5
5
  SHA512:
6
- metadata.gz: aa0b6516d6f2048b3cde856a839c19719e21b3d76945ffde305cf80da2bb2e1b010888537503344442e7e49790ea25b5850c9765addf36d70a98f2c90d171315
7
- data.tar.gz: e3a023a4f67ab7e1bde5944c5b632805a016ddeda65c2c347acdf15f88c33b92831586cd76942fdcf213f78a690aee72b90319a86d33836ba86109298cf5deaf
6
+ metadata.gz: eafd2f325ccfc4a7a310c1ec19b50e4f63ccea271d5bbc00cfcea9685a6d0e0be0bfccce3ff7cac87072e0ed7b2f73077809b0eb25322d98d96390105e4d2bdd
7
+ data.tar.gz: 18b64e07a3dae4e93f1ab9819ca920432d95687703838faea59e3b2a82254e7ecf637b0bca7afcb3a66b1ae4fff77e3ded722edda4cf79454aaf61a50293fe24
@@ -66,6 +66,19 @@ END
66
66
 
67
67
  private
68
68
 
69
+ ##
70
+ # Treat any missing method as an instance variable get/set
71
+ #
72
+ # This will allow arbitrary elements in Resource/Properties definitions
73
+ # to map to instance variables without having to anticipate them in a schema
74
+ def method_missing(method_name, *args)
75
+ if method_name =~ /^(\w+)=$/
76
+ instance_variable_set "@#{$1}", args[0]
77
+ else
78
+ instance_variable_get "@#{method_name}"
79
+ end
80
+ end
81
+
69
82
  def instance_variables_without_at_sign
70
83
  self.instance_variables.map { |instance_variable| strip(instance_variable) }
71
84
  end
@@ -105,7 +105,7 @@ class CfnParser
105
105
  end
106
106
 
107
107
  def generate_resource_class_from_type(type_name)
108
- resource_class = Class.new(DynamicModelElement)
108
+ resource_class = Class.new(ModelElement)
109
109
 
110
110
  module_names = type_name.split('::')
111
111
  if module_names.first == 'Custom'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfn-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kascic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-17 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kwalify
@@ -35,7 +35,6 @@ files:
35
35
  - lib/cfn-model.rb
36
36
  - lib/cfn-model/model/bucket_policy.rb
37
37
  - lib/cfn-model/model/cfn_model.rb
38
- - lib/cfn-model/model/dynamic_model_element.rb
39
38
  - lib/cfn-model/model/iam_group.rb
40
39
  - lib/cfn-model/model/iam_managed_policy.rb
41
40
  - lib/cfn-model/model/iam_policy.rb
@@ -1,21 +0,0 @@
1
- require_relative 'model_element'
2
-
3
- ##
4
- # This is the base class for a model element where we aren't anticipating
5
- # a schema or doing any fancier post-processing to think the element up
6
- # with other elements or wrap properties into higher-level objects
7
- #
8
- class DynamicModelElement < ModelElement
9
- ##
10
- # Treat any missing method as an instance variable get/set
11
- #
12
- # This will allow arbitrary elements in Resource/Properties definitions
13
- # to map to instance variables without having to anticipate them in a schema
14
- def method_missing(method_name, *args)
15
- if method_name =~ /^(\w+)=$/
16
- instance_variable_set "@#{$1}", args[0]
17
- else
18
- instance_variable_get "@#{method_name}"
19
- end
20
- end
21
- end