Module: Gemmy::Patches::ArrayPatch::InstanceMethods::Before

Defined in:
lib/gemmy/patches/array_patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.autotestObject



112
113
114
# File 'lib/gemmy/patches/array_patch.rb', line 112

def self.autotest
  [1,2].before(2) == 1
end

Instance Method Details

#before(value) ⇒ Object

facets



108
109
110
111
# File 'lib/gemmy/patches/array_patch.rb', line 108

def before(value)
  return nil unless include? value
  self[(index(value).to_i - 1) % length]
end