Sha256: 6037171d5d93a7fc12b25173b19335c888707d9e1d01a932881cd095cae43272
Contents?: true
Size: 611 Bytes
Versions: 3
Compression:
Stored size: 611 Bytes
Contents
#!/usr/bin/env ruby # -*- encoding: utf-8 -*- # Copyright Steffie Dorn <mail@muflax.com>, 2013 # License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html> class Array def triangle return to_enum(:triangle) unless block_given? self.each.with_index do |a, ai| self.each.with_index do |b, bi| next if bi < ai yield [a, b] end end end # silly accessors def second ; self[1] ; end def third ; self[2] ; end def fourth ; self[3] ; end def fifth ; self[4] ; end def rfind *arg, &block i = self.rindex(*arg, &block) i.nil? ? nil : self[i] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
muflax-0.5.5 | lib/muflax/array.rb |
muflax-0.5.3 | lib/muflax/array.rb |
muflax-0.5.2 | lib/muflax/array.rb |