Skip to content

Instantly share code, notes, and snippets.

View NicoSa's full-sized avatar
🏋️‍♂️

Nico Saueressig NicoSa

🏋️‍♂️
View GitHub Profile
class Array
def skip_first?(accumulator)
return 1 if accumulator.nil?
return 0 unless accumulator.nil?
end
def my_inject(accumulator = nil)
start = skip_first? accumulator
accumulator ||= self.first