Class: CloudFormer::Functions::And
- Inherits:
-
CloudFormer::Function
- Object
- CloudFormer::Function
- CloudFormer::Functions::And
- Defined in:
- lib/cloud_former/functions/and.rb
Instance Method Summary collapse
- #dump_json ⇒ Object
-
#initialize(*conditions) ⇒ And
constructor
A new instance of And.
Constructor Details
#initialize(*conditions) ⇒ And
Returns a new instance of And.
5 6 7 |
# File 'lib/cloud_former/functions/and.rb', line 5 def initialize(*conditions) @conditions = conditions end |
Instance Method Details
#dump_json ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cloud_former/functions/and.rb', line 9 def dump_json mapped = @conditions.map do |cond| if cond.is_a?(Condition) { 'Condition' => cond.get_name } elsif cond.is_a?(Function) cond.dump_json elsif cond.respond_to?(:get_name) { 'Ref' => cond.get_name } elsif cond.respond_to?(:to_s) cond.to_s end end { 'Fn::And' => mapped } end |