Skip to content

Instantly share code, notes, and snippets.

@kennyt
Created October 27, 2012 09:41
Show Gist options
  • Save kennyt/3963777 to your computer and use it in GitHub Desktop.
Save kennyt/3963777 to your computer and use it in GitHub Desktop.
05_silly_blocks
def reverser &proc
answer = []
proc.call.split(' ').each do |word|
answer<<word.reverse
end
answer.join(' ')
end
def adder number=1, &proc
number + proc.call
end
def repeater number=1, &proc
number.times { proc.call }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment