focal_point 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/focal_point.rb +12 -9
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/focal_point.rb CHANGED
@@ -27,15 +27,20 @@ class FocalPoint
27
27
  else
28
28
  $stdout.puts "FocalPoint::Error: Not sure how to instrument #{@target}"
29
29
  end
30
+
31
+ unless @scope.instance_methods.include?(@method) && false
32
+ # did you mean??
33
+ end
34
+
30
35
  @scope.module_eval(source)
31
36
  end
32
37
 
33
38
  def source
34
39
  <<-CODE
35
40
  alias :real_#{@method} :#{@method}
36
- def #{@method}(*args)
41
+ def #{@method}(*args, &block)
37
42
  FocalPoint[#{@target.inspect}].timer.measure do
38
- real_#{@method}(*args)
43
+ real_#{@method}(*args, &block)
39
44
  end
40
45
  end
41
46
  CODE
@@ -66,8 +71,6 @@ end
66
71
  alias :focal_points :focal_point
67
72
 
68
73
 
69
- =begin
70
-
71
74
  at_exit do
72
75
  FocalPoint.print_timers
73
76
  end
@@ -78,14 +81,14 @@ if $0 == __FILE__
78
81
  def self.bar
79
82
  5.times { sleep(1) }
80
83
  end
81
- def bar
82
- 5.times { sleep(1) }
84
+ def bar(&block)
85
+ block.call
83
86
  end
84
87
  end
85
88
  end
86
89
  focal_points('Quux::Foo.bar', 'Quux::Foo#bar')
87
90
  Quux::Foo.bar
88
- Quux::Foo.new.bar
91
+ Quux::Foo.new.bar do
92
+ 5.times { sleep(1) }
93
+ end
89
94
  end
90
-
91
- =end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: focal_point
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - levicook@gmail.com