var_block 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/var_block/getvar_handlers.rb +29 -21
- data/lib/var_block/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: 998eea81e5e8b080b472fad0b6c0d1ef180290d4
|
4
|
+
data.tar.gz: 8adc603eff6364c638f563c008f3cc421cd6da77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8180177a0f953389e1a8a07de925fd1c1d8211081ebc51c7d80591f22cca546d6312a16c972642c7e540e71b8d1f42fbc6de7c4c05c5716282a511b8147e0bcd
|
7
|
+
data.tar.gz: 6368db29acf39544be5702521d62b8f25820a9d4534d24c7021ccb04043ea9d4dcdbb80204c4a7b5c5397708997082f81e2e96538bb7e3d275d14ae6fd836b68
|
@@ -44,32 +44,40 @@ module VarBlock
|
|
44
44
|
case option
|
45
45
|
|
46
46
|
when :truthy?
|
47
|
-
|
48
|
-
|
49
|
-
value.each do |v|
|
50
|
-
if v.is_a? Proc
|
51
|
-
is_truthy = handle_proc(v, context)
|
52
|
-
else
|
53
|
-
is_truthy = handle_default(v)
|
54
|
-
end
|
55
|
-
break unless is_truthy
|
56
|
-
end
|
57
|
-
|
58
|
-
return is_truthy
|
47
|
+
return handle_option_truthy(value)
|
59
48
|
|
60
49
|
when :any?
|
61
|
-
value
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
50
|
+
return handle_option_any(value)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def handle_option_truthy(values)
|
56
|
+
is_truthy = true
|
69
57
|
|
70
|
-
|
58
|
+
values.each do |value|
|
59
|
+
if value.is_a? Proc
|
60
|
+
is_truthy = handle_proc(value, context)
|
61
|
+
else
|
62
|
+
is_truthy = handle_default(value)
|
71
63
|
end
|
64
|
+
break unless is_truthy
|
72
65
|
end
|
66
|
+
|
67
|
+
return is_truthy
|
68
|
+
end
|
69
|
+
|
70
|
+
def handle_option_any(values)
|
71
|
+
values.each do |value|
|
72
|
+
if value.is_a? Proc
|
73
|
+
is_truthy = handle_proc(value, context)
|
74
|
+
else
|
75
|
+
is_truthy = handle_default(value)
|
76
|
+
end
|
77
|
+
return true if is_truthy
|
78
|
+
end
|
79
|
+
|
80
|
+
return false
|
73
81
|
end
|
74
82
|
end
|
75
83
|
end
|
data/lib/var_block/version.rb
CHANGED