momo 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: befe622c1ebf025fb049faf7fd4ac45599983c2e
4
- data.tar.gz: e86b895df8edd1fb0314055fc30c767ba23f7393
3
+ metadata.gz: a9a70d90b34c3107bbf8f3cbb78d2bb23356ccb4
4
+ data.tar.gz: b7f6e273d64aa1948bd7586d2328ea93d62a1f3f
5
5
  SHA512:
6
- metadata.gz: ce1f018848a93e6170a89971ab7c18700305d12a80368446e5e620d5200fe69044bfe0c5ca6dd80f001eb592e566ad85ec6fc5c7db0c8fa961753c8f99a823a0
7
- data.tar.gz: de168af0051e6894ea89b4ded43fb78982334e2b1f8efb4dd66f3b794ef70b6d6279f46304b2fbedb1eba5e74f1561a424b7cc97da8a9b59c8bb54fffe66ad49
6
+ metadata.gz: fc35a7ebcd9b1b06c359e610ee7e8f0ed2e4a5c4695e98b05d3ffbf91ee3c055157de9d8b355cb1ddd3c7352b7802c8c401ab976f5742dd7df12642195656e2d
7
+ data.tar.gz: b7d59f2351609a22dcba48b0d872e03548cee89f17ac89b091a11101e39585e0e20d0f99a9a3efea8b3a5593c6611d228c1dab66a2745031ab86829784db61a1
@@ -26,7 +26,6 @@ module Momo
26
26
  elsif something.is_a? Reference
27
27
  return something.representation
28
28
  elsif something.is_a? BooleanValue
29
- options[:stack].conditions[something.signature] = something.representation
30
29
  return { "Condition" => something.signature }
31
30
  elsif something.is_a? FuncCall
32
31
  return something.representation
@@ -51,16 +50,39 @@ module Momo
51
50
  end
52
51
  end
53
52
 
53
+ module MomoCondition
54
+
55
+ def equals(another)
56
+ BooleanValue.new("Fn::Equals", @stack, self, another)
57
+ end
58
+
59
+ def and(another)
60
+ BooleanValue.new("Fn::And", @stack, self, another)
61
+ end
62
+
63
+ def or(another)
64
+ BooleanValue.new("Fn::Or", @stack, self, another)
65
+ end
66
+
67
+ end
68
+
54
69
  class BooleanValue < FuncCall
55
70
 
71
+ include MomoCondition
72
+
56
73
  def initialize(operator, stack, *args)
57
74
  super(operator, stack, args)
75
+ stack.conditions[self.signature] = self.representation
58
76
  end
59
77
 
60
78
  def not()
61
79
  BooleanValue.new("Fn::Not", @stack, self)
62
80
  end
63
81
 
82
+ def either(val_true, val_false)
83
+ FuncCall.new("Fn::If", @stack, self.signature, val_true, val_false)
84
+ end
85
+
64
86
  def signature_of(something)
65
87
  if something.is_a? String or
66
88
  something.is_a? TrueClass or
@@ -83,20 +105,4 @@ module Momo
83
105
 
84
106
  end
85
107
 
86
- module MomoCondition
87
-
88
- def equals(another)
89
- BooleanValue.new("Fn::Equals", @stack, self, another)
90
- end
91
-
92
- def and(another)
93
- BooleanValue.new("Fn::And", @stack, self, another)
94
- end
95
-
96
- def or(another)
97
- BooleanValue.new("Fn::Or", @stack, self, another)
98
- end
99
-
100
- end
101
-
102
108
  end
data/lib/momo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Momo
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: momo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw