Sha256: 5a96e92724ee68e593290d5c40ba8f9e735e6b8fd3806957ab66227989ca8ade
Contents?: true
Size: 578 Bytes
Versions: 7
Compression:
Stored size: 578 Bytes
Contents
class Array # Alias for unshift which puts an object on # on the first slot of an array. This is # the contrary of push. # # a=[1,2,3] # a.slap(9) #=> [9,1,2,3] # a #=> [9,1,2,3] # alias_method( :slap, :unshift ) end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCArray < Test::Unit::TestCase def test_slap a = [2,3] assert_equal( [1,2,3], a.slap(1) ) assert_equal( [4,1,2,3], a.slap(4) ) end end =end
Version data entries
7 entries across 7 versions & 1 rubygems