Sha256: 65acfe2c5a62e9ef4fed87a52c25aedc38f215862872be9f1a5364c5fb2f391a
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
#!/usr/bin/ruby class Array def rest retval = self.clone retval.shift return retval end def foldLeft(function) if self.size == 1 return self.first else return function.call(self.first, self.rest.foldLeft(function)) end end def eachAfter(element, &block) self[((self.index(element) or -1) + 1)..-1].each { |x| yield x } end def eachStartWith(element, &block) self[(self.index(element) or 0)..-1].each { |x| yield x } end end class Fixnum def not_equal?(num) self != num end end class Set def include_any?(enum) enum.each { |e| if self.include?(e) return true end } return false end end class Hash def include_hash?(hash) hash.each { |k,v| return false unless self[k] == v } return true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ConstraintSolver-0.1 | lib/extensions.rb |