class Momo::BooleanValue

Public Class Methods

new(operator, stack, *args) click to toggle source
Calls superclass method Momo::FuncCall::new
# File lib/momo/momoscope.rb, line 91
def initialize(operator, stack, *args)
        super(operator, stack, args)
        stack.conditions[self.signature] = self.representation
end

Public Instance Methods

either(val_true, val_false) click to toggle source
# File lib/momo/momoscope.rb, line 100
def either(val_true, val_false)
        FuncCall.new("Fn::If", @stack, self.signature, val_true, val_false)
end
not() click to toggle source
# File lib/momo/momoscope.rb, line 96
def not()
        BooleanValue.new("Fn::Not", @stack, self)
end
signature() click to toggle source
# File lib/momo/momoscope.rb, line 119
def signature()
        match = /Fn::(?<name>[a-z]+)/i.match(@name)
        "#{signature_of(@args[0])}#{match[:name]}#{signature_of(@args[1])}"
end
signature_of(something) click to toggle source
# File lib/momo/momoscope.rb, line 104
def signature_of(something)
        if something.is_a? String or 
                something.is_a? TrueClass or 
                something.is_a? FalseClass or
                something.is_a? Numeric
                return something
        elsif something.is_a? Hash
                return something["Ref"] || something["Condition"]
        elsif something.is_a? BooleanValue
                return something.signature
        elsif something.is_a? Resource
                return something.name
        end
end