Skip to content

Instantly share code, notes, and snippets.

@sam113101
Forked from gamov/ruby.rb
Last active September 18, 2015 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam113101/e1df958ce3a443b0fa9e to your computer and use it in GitHub Desktop.
Save sam113101/e1df958ce3a443b0fa9e to your computer and use it in GitHub Desktop.
Default value for an implicit block
def assert_sorted array
block = block_given? ? Proc.new : lambda {|i,j| i+1 < j+1}
assert array.each_cons(2).all?(&block), 'Result data not correctly sorted'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment