Sha256: f303934516c1d0269d2de96c377a85641643337077427879311e5a1c17911b90
Contents?: true
Size: 575 Bytes
Versions: 25
Compression:
Stored size: 575 Bytes
Contents
# From: http://jicksta.com/articles/2007/08/04/the-methodphitamine require 'blankslate' module Kernel def it() It.new end alias its it end class It instance_methods.reject { |m| m =~ /^__/ || m.to_s == 'object_id' }.each { |m| undef_method m } def initialize @methods = [] end def method_missing(*args, &block) @methods << [args, block] unless args == [:respond_to?, :to_proc] self end def to_proc lambda do |obj| @methods.inject(obj) do |current,(args,block)| current.send(*args, &block) end end end end
Version data entries
25 entries across 25 versions & 2 rubygems