nakajima-booty-call 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ module BootyCall
5
5
  extend(ClassMethods)
6
6
  @callbacker = BootyCall::Callbacker.new(self)
7
7
  @introspector = BootyCall::Introspector.new(self)
8
+ @meta_introspector = BootyCall::Introspector.new(self, :meta => true)
8
9
  end
9
10
  end
10
11
 
@@ -18,7 +19,8 @@ module BootyCall
18
19
  end
19
20
 
20
21
  def observe(method_id, options={}, &block)
21
- @introspector.observe(method_id, options, &block)
22
+ observer = options[:meta] ? @meta_introspector : @introspector
23
+ observer.observe(method_id, options, &block)
22
24
  end
23
25
 
24
26
  def callback(position, method_id, *args, &block)
@@ -10,7 +10,7 @@ module BootyCall
10
10
  def observe_klass!
11
11
  @observed ||= begin
12
12
  this = self
13
- hook = options[:metaclass] ? :singleton_method_added : :method_added
13
+ hook = options[:meta] ? :singleton_method_added : :method_added
14
14
  klass.meta_def(hook) do |m|
15
15
  this.check_method(m)
16
16
  end; true
@@ -1,7 +1,7 @@
1
1
  module BootyCall
2
2
  class ObservedMethod
3
3
  attr_reader :method_id
4
-
4
+
5
5
  def initialize(method_id, options={})
6
6
  @method_id = method_id
7
7
  @callbacks = []
@@ -20,7 +20,7 @@ module BootyCall
20
20
  end
21
21
 
22
22
  def valid?
23
- @times.eql?(:infinite) or @count < @times
23
+ @times.to_s.match(/^(inf|any|all|every)/) or @count < @times
24
24
  end
25
25
 
26
26
  def push(*args)
data/lib/booty_call.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH << File.dirname(__FILE__) + '/booty_call'
2
2
 
3
3
  module BootyCall
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
6
6
 
7
7
  require 'rubygems'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nakajima-booty-call
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Nakajima