aqui 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d04f21ddc9b10acfea60005040e69869af7e65e6
4
- data.tar.gz: a736934f6c3e348002fad72f02f2c6cf25c9bec1
3
+ metadata.gz: 4283d1f8b3d32fb240f29e7bbfa16b5a379fd80e
4
+ data.tar.gz: a814cecd825e3898898933a8fdd20708b4632444
5
5
  SHA512:
6
- metadata.gz: cd0a4f8d2bc9e540bcac9a71c9cb760f8155d99ea2e3eb7d58666cd6f66388a4ea48b93101e567956cbea3a116bb36b43dcff12c1e522c4d876d63a4c311b6fa
7
- data.tar.gz: a26c56ebf9d5e248a40b64863336717057c3f9e34e3fb585c97ccc4d8c8b90f19342943309b91500e19f4cd73b73d50c317653ceeabc51cf23747523f2a8abc6
6
+ metadata.gz: b5ebf64ef29f2bdb9b0b93d8c208a426c06ee9f3ea063976be5774587f5b53ef07afb0f29354fcef4d91766c5602a6c0f59eb369b80cffde638c59fc7d43712b
7
+ data.tar.gz: 18bcc4d4d41528a2c69f7d4e4e3ef690bc4ef135d433b8a0b438a9883041b28817af79de33b4c11c402305b302a633fff4308ccf450d7b8398ca62db08a615c0
data/README.md CHANGED
@@ -8,13 +8,24 @@ A gem for making sure some code is running.
8
8
 
9
9
  Sometimes when coding, you run into a situation where you want to make sure
10
10
  a bit of code is being executed by your application. You might end up
11
- typing something like:
11
+ typing something like the following, where you aren't positive if the code about `@noises_made` being run
12
12
 
13
13
  ~~~ruby
14
- try_this
15
- puts 'this is running'
16
- try_another
17
- puts 'blasfdd'
14
+ class Animal
15
+ def make_noise
16
+ @noises_made ||= 0
17
+ @noises_made += 1
18
+ puts 'noises are being made!'
19
+ nil
20
+ end
21
+ end
22
+
23
+ class Dog < Animal
24
+ def make_noise
25
+ super
26
+ 'bark'
27
+ end
28
+ end
18
29
  ~~~
19
30
 
20
31
  This way, you can run your code and check your logs to see if the `put`
@@ -22,15 +33,21 @@ methods were called. If this short and simple effective method works for you,
22
33
  then give `aqui` a shot next time. It looks like this:
23
34
 
24
35
  ~~~ruby
25
- try_this
26
- aqui
27
- try_another
28
- aqui
36
+ class Animal
37
+ def make_noise
38
+ @noises_made ||= 0
39
+ @noises_made += 1
40
+ aqui # <= add this!
41
+ nil
42
+ end
43
+ end
29
44
  ~~~
30
45
 
31
46
  This time, the output is colorized and contains information about where the code is running:
32
47
 
33
- ![screenshot](http://i.imgur.com/2AdA8YB.png)
48
+ ![screenshot](http://i.imgur.com/M1ULD9O.png)
49
+
50
+ Handy, huh?
34
51
 
35
52
  ## Installation
36
53
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require "bundler/gem_tasks"
2
2
  require 'rspec/core/rake_task'
3
3
 
4
4
  desc "Run specs"
5
- RSpec::Core::RakeTask.new do |t|
5
+ RSpec::Core::RakeTask.new do
6
6
  end
7
7
 
8
8
  task default: :spec
@@ -26,13 +26,18 @@ module Aqui
26
26
  @object.class.to_s.colorize(:light_white)
27
27
  end
28
28
 
29
+ def method
30
+ "##{@parser.method}".colorize(:light_green)
31
+ end
32
+
29
33
  def message
30
34
  [
31
35
  file,
32
36
  line_break,
33
37
  line_number,
34
38
  spacer,
35
- object_class
39
+ object_class,
40
+ method
36
41
  ].join('')
37
42
  end
38
43
  end
@@ -7,7 +7,7 @@ module Aqui
7
7
  end
8
8
 
9
9
  def parts
10
- @parts ||= @caller_message[0..@caller_message.index(':in `')].split(':')
10
+ @parts ||= @caller_message[0..method_index].split(':')
11
11
  end
12
12
 
13
13
  def file
@@ -17,5 +17,15 @@ module Aqui
17
17
  def line_number
18
18
  parts[1]
19
19
  end
20
+
21
+ def method
22
+ @caller_message[method_index + 5..-2]
23
+ end
24
+
25
+ private
26
+
27
+ def method_index
28
+ @caller_message.index(':in `')
29
+ end
20
30
  end
21
31
  end
@@ -1,4 +1,4 @@
1
1
  # Version File
2
2
  module Aqui
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
@@ -1,13 +1,22 @@
1
1
  require "bundler/setup"
2
2
  Bundler.require
3
3
 
4
- class ClassName
5
- def go
6
- 1 + 2
7
- aqui
8
- 3 + 4
4
+ # Animal
5
+ class Animal
6
+ def make_noise
7
+ @noises_made ||= 0
8
+ @noises_made += 1
9
9
  aqui
10
+ nil
11
+ end
12
+ end
13
+
14
+ # Dog
15
+ class Dog < Animal
16
+ def make_noise
17
+ super
18
+ 'bark'
10
19
  end
11
20
  end
12
21
 
13
- Model.new.go
22
+ Dog.new.make_noise
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aqui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hank