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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/what_error.rb +18 -14
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adb30cb1ddd47c1a0e0b02599298e0e7b7ec9116d0f308072379fccc53707b64
4
- data.tar.gz: 267ece92562a9415b3ce6f4dff3f36254b1fdc6c2c09985bfb41446784e0d144
3
+ metadata.gz: b31bf5d343a7b825f3f6e09eedf9da4a830576e616e7249a73ec4c5cc925a6dd
4
+ data.tar.gz: '098f318d2600912f25a4bc9cb0cb9b6eb2480c656990d1682c75becf0254d3a8'
5
5
  SHA512:
6
- metadata.gz: e8cc7ab3d831cfb25c3681bdb5754a2b9dc44b9da582e86c706309e0322b18fe3cd1d5dcd6a0f4c42ee523f51c786f4aa852c58939fad42a6be7b34dc6feb72e
7
- data.tar.gz: 83adf337fe4ea7fcbb26a1f14b49121bc8346c4b353252ba76bafce9dfd7c969efff23c782a806667518d9aae10eaf9d8c502494e762729df99f0542816b40da
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.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 in_irb? then
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
- return
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: what_error
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tacocat