snorkel 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/snorkel.rb +12 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f77e265f9285d9ae5588faa8d5b95492d644d4c3
4
- data.tar.gz: cec12589d90bbf6248f0028732f842c9e64e8274
3
+ metadata.gz: e67409085b19f4a945f6dd9d4e8dfc17a92442fe
4
+ data.tar.gz: 76eda0fa079c65917b0d49d0a820310b12641d19
5
5
  SHA512:
6
- metadata.gz: fd022b9b625b4d5a8366d6ddff78481f19ec7641a2366d824edbbf8f4cb630b4a2e0db3e0b1d02dbe842ebf1d757fb8cb7e75f48af0db737e8d50e2e3c5aa060
7
- data.tar.gz: e986bc2f788ddb4186f1ceece66a8c079b2a70a8d81bc7bc50f670f28f0a8c353ed00fda4c1e2e6fbfed6cab1cfeab112599234ea32a5ab7f6ab75460b16a63b
6
+ metadata.gz: c07b8dd897e3cbb8efd9ba895dac040a4978cb29e1e670ec3f4a430ec0b9a0c5d8a2e727a28fde9c72de4e59d1e9fde3a7c05f59c083db0eed1a91587d59bedb
7
+ data.tar.gz: f1c44ed923e62f46ad6c25873320e29712bf61215d7dfcc759096d1ed0be1e918ec06973aff37de663e8df85d550be1db8a3935700075ea6a8780ba436c16de2
@@ -4,6 +4,8 @@ require 'colored'
4
4
  class ErrorRescue
5
5
  def initialize(file)
6
6
  @file = File.open(file, "rb")
7
+ @file_name = file
8
+ @message = nil
7
9
  track_method
8
10
  ask_response
9
11
  end
@@ -11,14 +13,22 @@ class ErrorRescue
11
13
  def track_method
12
14
  begin
13
15
  eval(@file.read)
14
- rescue Exception => ex
16
+ rescue => ex
15
17
  @message = ex.message
18
+ @line = ex.backtrace
16
19
  end
17
20
  return if @message == nil
18
21
  end
19
22
 
23
+ def find_line
24
+ @line.map do |e|
25
+ e.match(/^(.+?):(\d+)(|:in `(.+)')$/)
26
+ $2
27
+ end
28
+ end
29
+
20
30
  def ask_response
21
- puts @message.capitalize.blue
31
+ puts "On line #{find_line[1]} of #{@file_name}: #{@message.capitalize}".blue
22
32
  puts "Would you like to search your error?"
23
33
  @response = $stdin.gets.chomp
24
34
  launch_search
@@ -36,4 +46,3 @@ class ErrorRescue
36
46
  end
37
47
 
38
48
 
39
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snorkel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danielle Adams, Ken Sin, Jessica Tatham, Vic Schaeperkoetter, Timothy McClung, Hallo