Sha256: 4d7d87ccd3190cc8c98e5cba1303b23381b351ce03b693d7fb30575b3f8a285e
Contents?: true
Size: 566 Bytes
Versions: 5
Compression:
Stored size: 566 Bytes
Contents
class Integer # Allows #succ to take _n_ increments. # # 3.succ(2) #=> 5 # # CREDIT: Trans def succ(n=1) self + n end # Provides #pred as the opposite of #succ. # # 3.pred(2) #=> 1 # # CREDIT: Trans def pred(n=1) self - n end end class String alias_method :succ1, :succ # Allows #succ to take _n_ step increments. # # "abc".succ #=> "abd" # "abc".succ(4) #=> "abg" # "abc".succ(24) #=> "aca" # # CREDIT: Trans def succ(n=1) s = self n.times { s = s.succ1 } s end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
facets-2.7.0 | lib/more/facets/succ.rb |
facets-2.6.0 | lib/more/facets/succ.rb |
facets-2.5.0 | lib/more/facets/succ.rb |
facets-2.5.1 | lib/more/facets/succ.rb |
facets-2.5.2 | lib/more/facets/succ.rb |