Class: Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/cfn-model/model/parameter.rb

Overview

copy-paste alert with ModelElement which should instead be Resource anyway

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object

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



24
25
26
27
28
29
30
# File 'lib/cfn-model/model/parameter.rb', line 24

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

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/cfn-model/model/parameter.rb', line 3

def id
  @id
end

#synthesized_valueObject

Returns the value of attribute synthesized_value.



5
6
7
# File 'lib/cfn-model/model/parameter.rb', line 5

def synthesized_value
  @synthesized_value
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/cfn-model/model/parameter.rb', line 3

def type
  @type
end

Instance Method Details

#emit_instance_varsObject



32
33
34
35
36
37
38
# File 'lib/cfn-model/model/parameter.rb', line 32

def emit_instance_vars
  instance_vars_str = ''
  self.instance_variables.each do |instance_variable|
    instance_vars_str += "  #{instance_variable}=#{instance_variable_get(instance_variable)}\n"
  end
  instance_vars_str
end

#is_no_echo?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/cfn-model/model/parameter.rb', line 7

def is_no_echo?
  !@noEcho.nil? && @noEcho.to_s.downcase == 'true'
end

#to_sObject



11
12
13
14
15
16
17
# File 'lib/cfn-model/model/parameter.rb', line 11

def to_s
  <<END
{
#{emit_instance_vars}
}
END
end