snorkel 0.0.5 → 0.0.6

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 +16 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e67409085b19f4a945f6dd9d4e8dfc17a92442fe
4
- data.tar.gz: 76eda0fa079c65917b0d49d0a820310b12641d19
3
+ metadata.gz: c6a66320c6a87e7c3add5bd6fba739b0bc02a4eb
4
+ data.tar.gz: dffc797231ed6c1606999f5a0c915a42008906fc
5
5
  SHA512:
6
- metadata.gz: c07b8dd897e3cbb8efd9ba895dac040a4978cb29e1e670ec3f4a430ec0b9a0c5d8a2e727a28fde9c72de4e59d1e9fde3a7c05f59c083db0eed1a91587d59bedb
7
- data.tar.gz: f1c44ed923e62f46ad6c25873320e29712bf61215d7dfcc759096d1ed0be1e918ec06973aff37de663e8df85d550be1db8a3935700075ea6a8780ba436c16de2
6
+ metadata.gz: d7937ab12717ba91efe35ddc069b3770475f9bce9e1fbfd10cc21b56e7c41b953f0aaa51de90d3e5563d76b521b17e56b5cb09a601c47dc60cd06439572cfd69
7
+ data.tar.gz: 277fed12feb129a063533cb953a916f7ee2a17c9168bea458d69a34da23de7727b48d9d6d24bf4bc54ff8bc7328db32ac87deee7a9354bd760b5e9b9d96c2a6b
@@ -3,14 +3,24 @@ require 'colored'
3
3
 
4
4
  class ErrorRescue
5
5
  def initialize(file)
6
- @file = File.open(file, "rb")
6
+ exit unless is_ruby?(file)
7
7
  @file_name = file
8
+ @file = File.open(file, "rb")
8
9
  @message = nil
9
- track_method
10
+ track_code
10
11
  ask_response
11
12
  end
12
13
 
13
- def track_method
14
+ def is_ruby?(file)
15
+ if file[-3..-1] != ".rb"
16
+ puts "You can only go snorkeling with Ruby!"
17
+ false
18
+ else
19
+ true
20
+ end
21
+ end
22
+
23
+ def track_code
14
24
  begin
15
25
  eval(@file.read)
16
26
  rescue => ex
@@ -30,13 +40,12 @@ class ErrorRescue
30
40
  def ask_response
31
41
  puts "On line #{find_line[1]} of #{@file_name}: #{@message.capitalize}".blue
32
42
  puts "Would you like to search your error?"
33
- @response = $stdin.gets.chomp
34
- launch_search
43
+ launch_search($stdin.gets.chomp)
35
44
  end
36
45
 
37
- def launch_search
46
+ def launch_search(response)
38
47
  new_message = @message.split(" ").join("+").downcase
39
- if @response.start_with? 'y'
48
+ if response.start_with? 'y'
40
49
  Launchy.open("https://www.google.com/#q=#{new_message}+ruby")
41
50
  else
42
51
  puts "Have a nice day!"
@@ -45,4 +54,3 @@ class ErrorRescue
45
54
 
46
55
  end
47
56
 
48
-
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danielle Adams, Ken Sin, Jessica Tatham, Vic Schaeperkoetter, Timothy McClung, Hallo