Sha256: bb6bda5763dfe5a4c38b7c402cacf469ec433f6f0553787be752d0d5c8316f74
Contents?: true
Size: 573 Bytes
Versions: 53
Compression:
Stored size: 573 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
53 entries across 53 versions & 1 rubygems