Sha256: 3ab4189daa1e7ae7f4c19a00bd74c055b324914416f8a52f3264726b94580840
Contents?: true
Size: 340 Bytes
Versions: 3
Compression:
Stored size: 340 Bytes
Contents
class Proc # Bind a procedure to an object. This works by # wrapping instance_eval on the Proc object and # then wrapping this in a new Proc. # # a = [1,2,3] # p1 = Proc.new{ join(' ') } # p2 = p1.bind_to(a) # p2.call #=> '1 2 3' # def bind_to(object) Proc.new{object.instance_eval(&self)} end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
facets-glimmer-3.2.0 | lib/core/facets/proc/bind_to.rb |
facets-3.1.0 | lib/core/facets/proc/bind_to.rb |
facets-3.0.0 | lib/core/facets/proc/bind_to.rb |