Sha256: cf3ab5354a4ecd88161bac1722eada96bcf5c8dc1bc381b255fe9b4d2497f97d
Contents?: true
Size: 489 Bytes
Versions: 4
Compression:
Stored size: 489 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 < BlankSlate 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
4 entries across 4 versions & 1 rubygems