momo 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/momo/momoscope.rb +23 -17
- data/lib/momo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a70d90b34c3107bbf8f3cbb78d2bb23356ccb4
|
4
|
+
data.tar.gz: b7f6e273d64aa1948bd7586d2328ea93d62a1f3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc35a7ebcd9b1b06c359e610ee7e8f0ed2e4a5c4695e98b05d3ffbf91ee3c055157de9d8b355cb1ddd3c7352b7802c8c401ab976f5742dd7df12642195656e2d
|
7
|
+
data.tar.gz: b7d59f2351609a22dcba48b0d872e03548cee89f17ac89b091a11101e39585e0e20d0f99a9a3efea8b3a5593c6611d228c1dab66a2745031ab86829784db61a1
|
data/lib/momo/momoscope.rb
CHANGED
@@ -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