3 require "decorate/private_method"
4 require "decorate/memoize"
21 extend Decorate::Memoize
25 puts "#{self}.m1(#{a}, #{b})"
34 puts "defining class method m1"
37 # Must hook into Object#singleton_method_added to make it work!
40 puts "#{self}.m1(#{a}, #{b})"
51 extend Decorate::Memoize
55 puts "#{self}.m1(#{a}, #{b})"
64 Decorate::Memoize.memoize
66 puts "#{self}.m1(#{a}, #{b})"
76 def private_toplevel_method
77 puts "private_toplevel_method called"
80 require "decorate/before_decorator"
82 extend Decorate::BeforeDecorator
84 before_decorator :trace_call, :call => :trace_call
86 def trace_call(method_name, *args, &block)
87 puts "Before #{self}.#{method_name}, args: #{args.inspect}, block: #{block.inspect}"
101 require "decorate/around_decorator"
103 extend Decorate::AroundDecorator
105 around_decorator :wrap, :call => :wrap
108 puts "Before #{call.inspect}"
110 puts "After #{call.inspect}"
115 def foo(*args, &block)
116 puts "foo: #{args.inspect}, block: #{block.inspect}"