1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
10 block, time = self, Time.now
11 (class << object; self end).class_eval do
12 method_name = "__bind_#{time.to_i}_#{time.usec}"
13 define_method(method_name, &block)
14 method = instance_method(method_name)
15 remove_method(method_name)
22 attr_reader :component
24 def initialize(klass = nil, &blk)
34 Factory.new(@component, &@blk.bind(object))