Sha256: 3f2867228780c8bd1fa88ad422a7b4a6e94a7b1817ec77d81fe4257243550764
Contents?: true
Size: 670 Bytes
Versions: 5
Compression:
Stored size: 670 Bytes
Contents
covers 'facets/kernel/tap' test_case Kernel do method :tap do test do e = "foo" r = "foobar".tap{ |x| x.gsub!(/bar/, '') } r.assert == e end test "check internal value" do x = [1,2,3] x.tap{ |a| a.assert == x } end test "assign via tap block" do bob = Struct.new(:name, :address, :zip).new x = lambda do |s| s.name = "Bob Sawyer" s.address = "123 Maple, Anytown NC" s.zip = "12345" end bob.tap(&x) bob.name.assert == "Bob Sawyer" bob.address.assert == "123 Maple, Anytown NC" bob.zip.assert == "12345" end end end
Version data entries
5 entries across 5 versions & 2 rubygems