what_error 0.1.1 β 0.1.2
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/what_error.rb +18 -14
- 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: b31bf5d343a7b825f3f6e09eedf9da4a830576e616e7249a73ec4c5cc925a6dd
|
|
4
|
+
data.tar.gz: '098f318d2600912f25a4bc9cb0cb9b6eb2480c656990d1682c75becf0254d3a8'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce628a9ca8d2b2327f561f73e1b6bc4251472b0ef9310c20aed547077c00bea2ab474690895f93e59e6a70049d200de1272ab255805a08070e464a2926a467d0
|
|
7
|
+
data.tar.gz: 7cfaac6537c9afa245aa38da81600e3a51d2775fe3a8aabe0c990bff2bf51fb1197102193e43d8baed30e65a9e9f8231b51b6df5ad7790bf3dd66960e5299355
|
data/lib/what_error.rb
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
def in_irb?
|
|
4
|
+
defined?(IRB) ||
|
|
5
|
+
$0 == "irb" ||
|
|
6
|
+
(caller.any? { |line| line.include?('irb') }) ||
|
|
7
|
+
(defined?(BindingInspector) && !ENV['TERM_PROGRAM'].nil?)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
if ! in_irb? then
|
|
11
|
+
|
|
3
12
|
module WhatError
|
|
4
|
-
VERSION = "0.1.
|
|
13
|
+
VERSION = "0.1.2"
|
|
5
14
|
class << self
|
|
6
15
|
def vykurchhtjtcddhtdxhxbfxbttxjyytsgnxtyxxfudutdutdtxx
|
|
7
16
|
# I rolled over my face on the keyboard
|
|
@@ -9,12 +18,9 @@ module WhatError
|
|
|
9
18
|
@cf = Kernel.caller[-1][/^(.+?):/, 1] or raise ArgumentError, "unknown file"
|
|
10
19
|
|
|
11
20
|
# Why?
|
|
12
|
-
if
|
|
13
|
-
puts "π«: Sorry, WhatError is disabled in IRB. Please require in actual ruby files. UwU, im so cuuuuuute."
|
|
14
|
-
return
|
|
15
|
-
elsif @cf =~ /-/ then
|
|
21
|
+
if @cf =~ /-/ then
|
|
16
22
|
puts "π«: UwU, I cannnnont red ths QAQ, SOOOOOOORRRYYYY!!! (Shrink into a ball)"
|
|
17
|
-
|
|
23
|
+
exit
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
@emojis = "πππππππ€£ππ€ππ₯°πππ€π€πππ·π ππ‘ππβΊοΈπ«πππ¨π°πππ±π£π₯Ίπ€ππ₯π€π’πͺπππ©ππ
π₯΅π€‘π€₯π€π€«π€€π€ͺπ€―π€©π₯Άπ« π΅βπ«π€’π©πΎπ".chars
|
|
@@ -49,13 +55,6 @@ module WhatError
|
|
|
49
55
|
return "#{@cf}:#{rand(1..10000)}: #{e.message} (\e[1;4m#{e.class}\e[0m)\n"
|
|
50
56
|
end
|
|
51
57
|
|
|
52
|
-
def in_irb?
|
|
53
|
-
defined?(IRB) ||
|
|
54
|
-
$0 == "irb" ||
|
|
55
|
-
(caller.any? { |line| line.include?('irb') }) ||
|
|
56
|
-
(defined?(BindingInspector) && !ENV['TERM_PROGRAM'].nil?)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
58
|
def sub_fake_backtrace(e)
|
|
60
59
|
bt = e.backtrace.map do |b|
|
|
61
60
|
b.gsub(/'.+?'/, @emojis.sample)
|
|
@@ -72,4 +71,9 @@ module WhatError
|
|
|
72
71
|
end
|
|
73
72
|
|
|
74
73
|
WhatError.vykurchhtjtcddhtdxhxbfxbttxjyytsgnxtyxxfudutdutdtxx
|
|
75
|
-
WhatError.send(:in_irb?)
|
|
74
|
+
WhatError.send(:in_irb?)
|
|
75
|
+
|
|
76
|
+
else
|
|
77
|
+
puts "π«: Sorry, WhatError is disabled in IRB. Please require in actual ruby files. UwU, im so cuuuuuute."
|
|
78
|
+
raise "disabled in IRB"
|
|
79
|
+
end
|