Class: Momo::BooleanValue
- Includes:
- MomoCondition
- Defined in:
- lib/momo/momoscope.rb
Instance Method Summary collapse
- #either(val_true, val_false) ⇒ Object
-
#initialize(operator, stack, *args) ⇒ BooleanValue
constructor
A new instance of BooleanValue.
- #not ⇒ Object
- #signature ⇒ Object
- #signature_of(something) ⇒ Object
Methods included from MomoCondition
Methods inherited from FuncCall
Constructor Details
#initialize(operator, stack, *args) ⇒ BooleanValue
Returns a new instance of BooleanValue.
91 92 93 94 |
# File 'lib/momo/momoscope.rb', line 91 def initialize(operator, stack, *args) super(operator, stack, args) stack.conditions[self.signature] = self.representation end |
Instance Method Details
#either(val_true, val_false) ⇒ Object
100 101 102 |
# 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 ⇒ Object
96 97 98 |
# File 'lib/momo/momoscope.rb', line 96 def not() BooleanValue.new("Fn::Not", @stack, self) end |
#signature ⇒ Object
119 120 121 122 |
# 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) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# 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 |