Class: ModelElement
- Inherits:
-
Object
- Object
- ModelElement
- Defined in:
- lib/cfn-model/model/model_element.rb
Direct Known Subclasses
AWS::EC2::Instance, AWS::EC2::NetworkInterface, AWS::EC2::SecurityGroup, AWS::EC2::SecurityGroupEgress, AWS::EC2::SecurityGroupIngress, AWS::ElasticLoadBalancing::LoadBalancer, AWS::ElasticLoadBalancingV2::LoadBalancer, AWS::IAM::Group, AWS::IAM::ManagedPolicy, AWS::IAM::Policy, AWS::IAM::Role, AWS::IAM::User, AWS::IAM::UserToGroupAddition, AWS::S3::BucketPolicy, AWS::SNS::TopicPolicy, AWS::SQS::QueuePolicy
Instance Attribute Summary collapse
-
#logical_resource_id ⇒ Object
Returns the value of attribute logical_resource_id.
-
#resource_type ⇒ Object
Returns the value of attribute resource_type.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object (private)
Treat any missing method as an instance variable get/set
This will allow arbitrary elements in Resource/Properties definitions to map to instance variables without having to anticipate them in a schema
78 79 80 81 82 83 84 |
# File 'lib/cfn-model/model/model_element.rb', line 78 def method_missing(method_name, *args) if method_name =~ /^(\w+)=$/ instance_variable_set "@#{$1}", args[0] else instance_variable_get "@#{method_name}" end end |
Instance Attribute Details
#logical_resource_id ⇒ Object
Returns the value of attribute logical_resource_id.
49 50 51 |
# File 'lib/cfn-model/model/model_element.rb', line 49 def logical_resource_id @logical_resource_id end |
#resource_type ⇒ Object
Returns the value of attribute resource_type.
49 50 51 |
# File 'lib/cfn-model/model/model_element.rb', line 49 def resource_type @resource_type end |
Instance Method Details
#==(another_model_element) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cfn-model/model/model_element.rb', line 59 def ==(another_model_element) found_unequal_instance_var = false instance_variables_without_at_sign.each do |instance_variable| if instance_variable != :logical_resource_id if self.send(instance_variable) != another_model_element.send(instance_variable) found_unequal_instance_var = true end end end !found_unequal_instance_var end |
#to_s ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/cfn-model/model/model_element.rb', line 51 def to_s <<END { #{emit_instance_vars} } END end |