You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseLoadError,"The CONDITIONALS constant in class #{self} is of the wrong type (#{h.class}). Either make it a Hash or override #{self}.conditionals to return a list of symbols."unlessh.kind_of?Hash
7
+
h.keys
8
+
end
9
+
10
+
definitializeconditional,predicate,options={}
11
+
12
+
@conditional=resolve_conditionalconditional
13
+
raiseArgumentError,"Conditional must be either :if or :unless"unlessALLOWED_CONDITIONALS.include?@conditional
14
+
15
+
@predicate=predicate
16
+
end
17
+
18
+
deffulfilled? *args
19
+
result=check@predicate, *args
20
+
result= !resultif@conditional == :unless
21
+
result
22
+
end
23
+
24
+
defresolve_conditionalconditional
25
+
conditional
26
+
end
27
+
28
+
defcheckpredicate,value,context,options={}
29
+
raiseNotImplementedError,"Subclasses should implement the #check method to check whether the value matches the predicate of the condition"
0 commit comments