yellowscorpion 0.0.0 → 0.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/yellowscorpion/assert.rb +6 -2
- data/lib/yellowscorpion/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c944d90ea63a003756698faee233594871dc69b3fd7e19d80bd46f8cf16b9a7
|
4
|
+
data.tar.gz: 90b342259f0cc084c697a204291a064c3f9879efda5c6fdcf45a810700e816fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef0c8da40bd6b309fa06adf958b98c6ded07268129ed8aa35dade013737a1fdf26cd9f37b126e560eb29a44e0574b2aabb4e00eac8f7a7455050700e63701ff2
|
7
|
+
data.tar.gz: '0291c05a8fd2d89c8177039807ea99ea19db13b358add494712d0b5b3f88bd1a3ddfd794962f606d2c65490a2ef7616d2d0bd26721c1217d49a99b8b245e69af'
|
@@ -3,8 +3,12 @@ module Yellowscorpion
|
|
3
3
|
def assert(expression)
|
4
4
|
return if expression == true
|
5
5
|
|
6
|
-
backlocation = caller_locations(1, 1)[0]
|
7
|
-
|
6
|
+
backlocation = caller_locations(1, 1)[0]
|
7
|
+
lineno = backlocation.lineno
|
8
|
+
method_name = backlocation.to_s[/`.*'/][1..-2].split(" ")[-1]
|
9
|
+
filename = backlocation.to_s.split(":")[0]
|
10
|
+
message = "Assertion failed: method #{method_name}, file #{filename}, line #{lineno}."
|
11
|
+
printf "\e[31m#{message}\e[0m \n"
|
8
12
|
abort
|
9
13
|
end
|
10
14
|
end
|