anchor 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +2 -2
- data/lib/anchor/hooks.rb +0 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -53,8 +53,8 @@ Or run:
|
|
53
53
|
|
54
54
|
=== Getting called method's arguments and block
|
55
55
|
|
56
|
-
anchor Anchor::Hooks do
|
57
|
-
before singleton :included do |*args, &block|
|
56
|
+
anchor Anchor::Hooks do # sets *anchor* on module *Anchor::Hooks*
|
57
|
+
before singleton :included do |*args, &block| # sets *hook* on singleton method called included
|
58
58
|
puts "Just anchored on #{args[0]} with #{block}"
|
59
59
|
end
|
60
60
|
end
|
data/lib/anchor/hooks.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
module Anchor
|
3
3
|
def self.hook(*objs, &block) # :nodoc:
|
4
4
|
objs.each do |obj|
|
5
|
-
#puts "Trying to hook: #{obj} #{block.inspect}"
|
6
5
|
Hooks.included(obj)
|
7
6
|
obj.instance_eval &block
|
8
7
|
end
|
@@ -30,7 +29,6 @@ module Anchor
|
|
30
29
|
alias :add_hook :add_hook_for_methods
|
31
30
|
|
32
31
|
def add_hook_for_method(type, method, &block)
|
33
|
-
puts "#{self} #{type} #{method} #{block} ----------"
|
34
32
|
level, name = case method; when Hash; method.shift; when Symbol; [:instance, method]; end
|
35
33
|
# set hooks on metaclass instance, not self, if method has to be class method or self is a Object
|
36
34
|
in_scope = :metaclass if level == :singleton or not self.is_a?(Class)
|